ASA Programming Guide
JDBC Programming
Using the jConnect JDBC driver
To connect to a database via jConnect, you need to supply a Uniform Resource Locator (URL) for the database. An example given in the section Connecting from a JDBC client application using jConnect is as follows:
StringBuffer temp = new StringBuffer(); // Use the jConnect driver... temp.append("jdbc:sybase:Tds:"); // to connect to the supplied machine name... temp.append(_coninfo); // on the default port number for ASA... temp.append(":2638"); // and connect. System.out.println(temp.toString()); conn = DriverManager.getConnection(temp.toString() , _props );
The URL is put together in the following way:
jdbc:sybase:Tds:machine-name:port-number
The individual components are:
jdbc:sybase:Tds The Sybase jConnect JDBC driver, using the TDS application protocol.
machine-name The IP address or name of the machine on which the server is running. If you are establishing a same-machine connection, you can use localhost, which means the current machine
port number The port number on which the database server listens. The port number assigned to Adaptive Server Anywhere is 2638. Use that number unless there are specific reasons not to do so.
The connection string must be less than 253 characters in length.
Specifying a database on a server
Database options set for jConnect connections