Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere JDBC API » Using the jConnect JDBC driver

 

Supplying a URL to the driver

To connect to a database via jConnect, you need to supply a URL for the database. For example:

Connection con = DriverManager.getConnection(
      "jdbc:sybase:Tds:localhost:2638", "DBA", "sql");

The URL is composed in the following way:

jdbc:sybase:Tds:host:port

The individual components are:

  • jdbc:sybase:Tds   The jConnect JDBC driver, using the TDS application protocol.

  • host   The IP address or name of the computer on which the server is running. If you are establishing a same-host connection, you can use localhost, which means the computer system you are logged into.

  • port   The port number on which the database server listens. The port number assigned to SQL 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