Defining a JDBC Client using a Connection URL
The following instruction are provided as guidelines only. You will need to determine exactly what your client programming environment requires.
This topic also includes the following:
To create a client program
1. Create your client application and declare your connection URL, using the following syntax:
{TDV <version number>};Server=fully qualified hostname;Port=9401;User=username;Password=password;domain=Composite domainname;dataSource=datasource name
For example, for Java you might add:
String url = "jdbc:compositesw:dbapi@localhost:9401?"
+"domain=composite&dataSource=cdspt";
String user = "compUser";
String pass = "compPassword";
// Load driver
Class.forName("cs.jdbc.driver.CompositeDriver");
// Create connection
conn = DriverManager.getConnection(url, user, pass);
2. Declare the username and password variables for use in the connection statement.
3. (Optional) Determine the JDBC driver name using one of the following methods, depending on platform type:
Platform | Location of Name |
Windows | The Driver Name can be found from the Data Source tab of the JDBC Data Source Administrator. |
4. (Optional) Write a small sample program that you can use to test the connection URL.
5. Create or modify your client program so that it includes the connection syntax. For example, you must include a statement similar to the following to establish the connection:
conn = DriverManager.getConnection(url, userName, password);