Skip Top Menu Navigation
Skip Top Menu Navigation

The FREE Enterprise Open Source Database

  Software Documentation Tools Interfaces Administration Development
 

 
You Are Here:  SAP DB > 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

  1. 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.
  2. The JDBC driver is implemented by the class com.sap.dbtech.jdbc.DriverSapDB,
    the URL must be of the form
    jdbc:sapdb://<host>[:port]/<database_name>
    The port specification is optional and necessary only if your database server listens at a non-standard port.
    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 that uses the standard TCP/IP port, the host name can be omitted ("jdbc:sapdb:" + database_name).
  3. 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>
  4. For detailed connection properties, see the Documentation.
  5. The JDBC driver has been successfully tested with the Java query tool DbVisualizer and the JAVA App-Server JBOSS.


Search / Contact Info













Questions or comments about the Web site? Contact the webmaster.