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

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere JDBC driver » Connecting from a JDBC client application » Establishing a connection from a server-side JDBC class

 

How the server-side connection example differs

The server-side connection example is almost identical to the client-side connection example, with the following exceptions:

  1. The driver manager does not need to be loaded. The following code has been removed from the example.

    DriverManager.registerDriver( (Driver)
      Class.forName(
      // "com.sybase.jdbc3.jdbc.SybDriver").newInstance()
      "ianywhere.ml.jdbcodbc.IDriver").newInstance()
      );
  2. It connects to the default running database using the current connection. The URL in the getConnection call has been changed as follows:

    Connection con = DriverManager.getConnection(
              "jdbc:default:connection" );
  3. The System.exit() statements have been removed.