A difference between JDBC on the client and in the database server lies in establishing a connection with the database environment.
Client side In client-side JDBC, establishing a connection requires a SQL Anywhere JDBC driver or the jConnect JDBC driver. Passing arguments to DriverManager.getConnection establishes the connection. The database environment is an external application from the perspective of the client application.
Server-side When using JDBC within the database server, a connection already exists. The string "jdbc:default:connection" is passed to DriverManager.getConnection, which allows the JDBC application to work within the current user connection. This is a quick, efficient, and safe operation because the client application has already passed the database security to establish the connection. The user ID and password, having been provided once, do not need to be provided again. The server-side JDBC driver can only connect to the database of the current connection.
You can write JDBC classes so that they can run both at the client and at the server by employing a single conditional statement for constructing the URL. An external connection requires the host name and port number, while the internal connection requires "jdbc:default:connection".
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |