Difference between revisions of "Documentation/DevGuide/Database/The SDBC Driver for JDBC"
From Apache OpenOffice Wiki
< Documentation | DevGuide
OOoWikiBot (Talk | contribs) m (FINAL VERSION FOR L10N) |
|||
Line 10: | Line 10: | ||
{{DISPLAYTITLE:The SDBC Driver for JDBC}} | {{DISPLAYTITLE:The SDBC Driver for JDBC}} | ||
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 <code>JavaDriverClass</code> 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. | 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 <code>JavaDriverClass</code> 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. | ||
− | + | <syntaxhighlight lang="java"> | |
// first create the needed url | // first create the needed url | ||
String url = "jdbc:mysql://localhost:3306/TestTables"; | String url = "jdbc:mysql://localhost:3306/TestTables"; | ||
Line 26: | Line 26: | ||
// now create a connection to adabas | // now create a connection to adabas | ||
xConnection = xDriverManager.getConnectionWithInfo(url, props); | xConnection = xDriverManager.getConnectionWithInfo(url, props); | ||
− | + | </syntaxhighlight> | |
Other properties that require setting during the connect process depend on the JDBC driver that is used. | Other properties that require setting during the connect process depend on the JDBC driver that is used. | ||
Latest revision as of 14:09, 21 December 2020
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). |