Using dw-jdbc in your project
If using Maven, you can use dw-jdbc by just including the following in your pom.xml file:
<dependency> <groupId>world.data</groupId> <artifactId>dw-jdbc</artifactId> <version>0.4.1</version> </dependency>
See this link at Maven Central to find the latest version number for the JDBC driver.
For some database tools it's easier to install the jdbc driver if it's a single jar. For this reason we also provide dw-jdbc bundled with all its dependencies under the following:
<dependency> <groupId>world.data</groupId> <artifactId>dw-jdbc</artifactId> <classifier>shaded</classifier> <version>0.4.1</version> </dependency>
Visit https://data.world
Visit your user settings, and click the advanced tab.
Copy your token.
JDBC 4.2
The driver only supports read-only queries. It does not support INSERT/UPDATE/DELETE, DDL, or transactions.
Queries can be written in SPARQL 1.1 or in the SQL dialect described at https://docs.data.world/tutorials/dwsql/.
[SQL-only] Table and column metadata via
java.sql.DatabaseMetaData
.[SQL-only] Support for positional parameters via
java.sql.PreparedStatement
.[SPARQL-only] Support for named parameters via
java.sql.CallableStatement
.For example,
CallableStatement.setString("name", "value")
will bind the stringvalue
to?name
within the query.
The
DataWorldStatement.setJdbcCompatibilityLevel(JdbcCompatibility)
method can be used to adjust how the JDBC driver maps query results to Java objects injava.sql.ResultSetMetaData
. This is particularly relevant to SPARQL queries where result types in a column can vary from row to row.JdbcCompatibility.LOW
- No assumptions are made about types.ResultSetMetaData.getColumnType()
returnsjava.sql.Types.OTHER
andResultSet.getObject()
returnsworld.data.jdbc.model.Node
.JdbcCompatibility.MEDIUM
- [SPARQL default] All columns are typed as string.ResultSetMetaData.getColumnType()
returnsjava.sql.Types.NVARCHAR
andResultSet.getObject()
returnsjava.lang.String
.JdbcCompatibility.HIGH
- [SQL default] Columns are typed based on the underlying data, either using table metadata (SQL) or by inspecting the first row of the response (SPARQL).