Connection properties must be set before connecting to a server. You can set connection properties in two ways:
Use the DriverManager.getConnection method in your application.
Set the connection properties when you define the URL.
Driver connection properties set in the URL do not override any corresponding connection properties set in the application using the DriverManager.getConnection method.
Following is a sample code that 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);