Setting Connection Properties

You must set connection properties before you connect to a server.

Set the connection properties by either:
  • Using the DriverManager.getConnection method in your application, or,

  • Setting the connection properties when you define the URL.

    Note: Driver connection properties that you set in the URL do not override any corresponding connection properties set in the application using the DriverManager.getConnection method.
This sample code uses the DriverManager.getConnection method. The sample programs provided with jConnect also contain examples of setting these properties.
 Properties props = new Properties();
  props.put("user", "userid");
  props.put("password", "user_password");
 /*
  * If the program is an applet that wants to access
  * a server that is not on the same host as the
  * web server, then it uses a proxy gateway.
  */
  props.put("proxy", "localhost:port");
 /*
  * Make sure you set connection properties before
  * attempting to make a connection. You can also
  * set the properties in the URL.
  */
 Connection con = DriverManager.getConnection
   ("jdbc:sybase:Tds:host:port", props);