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.

If you are using the SQL Anywhere personal server, make sure to include the TCP/IP support option when starting the server.


Specifying a database on a server
Database options set for jConnect connections