To register and invoke the Sybase jConnect driver, use either of the following two suggested methods:
Use a Class.forName call as in the following example:
Class.forName("com.sybase.jdbc2.jdbc.SybDriver") .newInstance();
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());
System.getProperties( ) is not allowed
for Java applets. Use the
Class.forName( ) method, instead.
Copyright © 2003. Sybase Inc. All rights reserved. |
![]() |