C-JDBC is a database cluster middleware that allows any Java application (standalone application, servlet or EJB container, ...) to transparently access a cluster of databases through JDBC. You do not have to modify client applications, application servers or database server software. You just have to ensure that all database accesses are performed through JDBC.
First you will need to install C-JDBC. The easiest way to install C-JDBC is to use the Java graphical installer. A Java Virtual Machine is of course needed in this case. Simply launch the installation program by typing:
java -jar c-jdbc-x.y.bin-installer.jar
(Check CJDBC_HOME environment variable)
Once you have installed the C-JDBC controller, you will find the driver JAR in the drivers/ directory of the controller installation location.
To install the C-JDBC driver, you just have to add the c-jdbc-driver.jar to the client application classpath. This driver replaces the database native driver in the client application.
The database native driver will be used by the C-JDBC controller to access your database. Therefore, the C-JDBC driver and controller can be seen as a proxy between your application and your database native driver.
DODS uses C-JDBC as any standard JDBC driver.
In the application configuration file <appName>/output/conf/<appName>.conf (or better, in <appName>/input/conf/<appName>.conf.in ) identify the JDBC driver with the line:
DatabaseManager.DB.<database_id>.JdbcDriver=”org.objectweb.cjdbc.driver.Driver"
In the same configuration file, identify the database with the database URL .
The JDBC URL expected for the use with C-JDBC is the following:
jdbc:cjdbc://host1:port1,host2:port2/database.
Host is the machine name (or IP address) where the C-JDBC controller is running, port is the port where the controller is bound on this host.
At least one host must be specified but a list of comma separated hosts can be specified. If several hosts are given, one is picked up randomly from the list. If the currently selected controller fails, another one is automatically picked up from the list.
Default port number is 25322 (C-JDBC on the phone !) if omitted. Those two URL are equivalent:
"jdbc:cjdbc://localhost:/tpcw" "jdbc:cjdbc://localhost:25322/tpcw"
So set URL in conf file to:
DatabaseManager.DB.<database_id>.Connection.Url = " jdbc:cjdbc://<host>:<port>"
Example:
#------------------------------------------------------------------- # Database Manager Configuration #------------------------------------------------------------------- DatabaseManager.Databases[] = "<database_id>" DatabaseManager.DefaultDatabase = "<database_id>" DatabaseManager.DB.<database_id>.ClassType = "Standard" DatabaseManager.DB.<database_id>.JdbcDriver = =”org.objectweb.cjdbc.driver.Driver" DatabaseManager.DB.<database_id>.Connection.Url = " jdbc:cjdbc://<host>:<port>" DatabaseManager.DB.<database_id>.Connection.User = "<name>" DatabaseManager.DB.<database_id>.Connection.Password = "<password>" DatabaseManager.DB.<database_id>.Connection.MaxPoolSize = "2" DatabaseManager.DB.<database_id>.Connection.AllocationTimeout = "2" DatabaseManager.DB.<database_id>.Connection.Logging = "true" DatabaseManager.DB.<database_id>.ObjectId.CacheSize = 2 DatabaseManager.DB.<database_id>.ObjectId.MinValue = 1
Details of creating, configuring and starting C-JDBC database is out of scope of this document. All details about these features can be found on http://c-jdbc.objectweb.org
C-JDBC is a free, open source ObjectWeb Consortium ( http://www.objectweb.org)'s project. It is licensed under the GNU Lesser General Public License