To connect to a database via jConnect, you need to supply a Universal Resource Locator (URL) for the database. An example given in the section is as follows:
StringBuffer temp = new StringBuffer(); // Use the Sybase 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 include:
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 Sybase IQ 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.