Register and invoke SAP jConnect, and add SAP jConnect 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 calling Class.forName. You can list multiple drivers in this property, separated with a colon (:).
Properties sysProps = System.getProperties(); String drivers = "com.sybase.jdbc4.jdbc.SybDriver"; String oldDrivers = sysProps.getProperty("jdbc.drivers"); if (oldDrivers != null) drivers += ":" + oldDrivers; sysProps.put("jdbc.drivers", drivers.toString());
java -Djdbc.drivers=com.sybase.jdbc4.jdbc.SybDriver UseDriverYou need not use the UseDriver program to load the driver explicitly:
public class UseDriver { public static void main(String[] args) { try { Connection conn = java.sql.DriverManager.getConnection ("jdbc:sybase:Tds:localhost:5000?USER=sa&PASSWORD=secret"); // more code to use connection ... } catch (SQLException se){ System.out.println("ERROR: SQLException "+se); } } }