 
 |
You Are Here: SAP DB > 7.3 > Interfaces > JDBC
SAP DB is now SAP MaxDB! For more information, visit the SAP MaxDB pages in the SAP Developer Network.
SAP DB JDBC Driver
Features
- 100 Percent pure Java
- Supports JDK 1.2 and higher
- Supports JDBC 2.0 (with JDK 1.2)
- Supports JDBC 3.0 (with JDK 1.4)
- Supports the JDBC 2.0 Standard Extension API (DataSource, XADataSource and ConnectionPoolDataSource)
- Type 4 driver (Connects to the database using the proprietary SAP DB socket protocol)
Download
Documentation JDBC Quick Start
sapdbc.jar must be found through the CLASSPATH
(CLASSPATH=$CLASSPATH:<completepath>/sapdbc.jar or
java -classpath $CLASSPATH:<completepath>/sapdbc.jar
classname)
For JDK 1.2, you can install the driver as an extension by copying sapdbc.jar
to <JAVA Root>/jre/lib/ext.
- The JDBC driver is implemented by the class
com.sap.dbtech.jdbc.DriverSapDB,
the URL must be of the form jdbc:sapdb://<host>/<database_name>
Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");
java.sql.Connection connection =
java.sql.DriverManager.getConnection (
"jdbc:sapdb://" + host + "/" + database_name,
user_name, password)
When connecting to a local database, the host name can be omitted ("jdbc:sapdb:" + database_name).
- The minimal JDBC program:
Statement stmt = connection.createStatement ();
resultSet.next ();
String hello = resultSet.getString (1);
System.out.println (hello);
For the complete example, see
HelloSapDB.java (Source) and
HelloSapDB.class.
Call as JDK 1.2:
java -classpath .:sapdbc.jar HelloSapDB -u
<user_name>,<password> -d <database_name>
JDK 1.1:
java -classpath $CLASSPATH:.:sapdbc.jar HelloSapDB
-u <user_name>,<password> -d <database_name>
- For detailed connection properties, see the
Documentation.
- The JDBC driver has been successfully tested with the Java query tool DbVisualizer and the JAVA App-Server JBOSS.
|
|
|