The SDBC Driver for JDBC

From Apache OpenOffice Wiki
Jump to: navigation, search



The SDBC driver for JDBC is a mapping from SDBC API calls to the JDBC API, and vice versa. Basically, this driver is a direct bridge to JDBC. The SDBC driver for JDBC requires a special property called JavaDriverClass to know which JDBC driver should be used. The expected value of this property should be the complete class name of the JDBC driver. The following code snippet uses a MySQL JDBC driver to connect.

  // first create the needed url
  String url = "jdbc:mysql://localhost:3306/TestTables";
 
  // second create the necessary properties
  com.sun.star.beans.PropertyValue [] props = new com.sun.star.beans.PropertyValue[] {
      new [ com.sun.star.beans.PropertyValue]("user", 0, "test1", 
          com.sun.star.beans.PropertyState.DIRECT_VALUE),
      new com.sun.star.beans.PropertyValue("password", 0, "test1",
          com.sun.star.beans.PropertyState.DIRECT_VALUE),
      new com.sun.star.beans.PropertyValue("JavaDriverClass", 0, "org.gjt.mm.mysql.Driver",
          com.sun.star.beans.PropertyState.DIRECT_VALUE)
  };
 
  // now create a connection to adabas
  xConnection = xDriverManager.getConnectionWithInfo(url, props);

Other properties that require setting during the connect process depend on the JDBC driver that is used.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages