To register and invoke the Sybase jConnect driver, use either of the following two suggested methods:
Use Class.forName as shown:
Class.forName("com.sybase.jdbc3.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 callingClass.forName. 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.jdbc3.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. Instead, use the Class.forName method.