CANCEL_ALL connection property  Establishing a connection

Chapter 2: Programming Information

Invoking the jConnect driver

To register and invoke the Sybase jConnect driver, use either of the following two suggested methods:

  1. Use a Class.forName call as in the following example:

    Class.forName("com.sybase.jdbc2.jdbc.SybDriver")
    .newInstance();
    
  2. Add the jConnect driver to the jdbc.drivers system property. At initialization, the DriverManager class attempts to load the drivers listed in jdbc.drivers. This is less efficient than the Class.forName call approach. You can list multiple drivers in this property, separated with a colon (:). The following code samples show how to add a driver to jdbc.drivers within a program:

    Properties sysProps = System.getProperties();
    String drivers = "com.sybase.jdbc2.jdbc.SybDriver";
    String oldDrivers =
    sysProps.getProperty("jdbc.drivers");
    if (oldDrivers != null)
       drivers += ":" + oldDrivers;
     sysProps.put("jdbc.drivers", drivers.toString());
    

NoteSystem.getProperties( ) is not allowed for Java applets. Use the Class.forName( ) method, instead.





Copyright © 2003. Sybase Inc. All rights reserved. Establishing a connection

View this book as PDF