Connect to datasets using JDBC driver

dw-jdbc is a JDBC driver for connecting to datasets hosted on It can be used to provide read-only access to any dataset provided by from any JVM language. dw-jdbc supports query access both in SQL ('s dialect - see details in our SQL tutorial) and in SPARQL 1.1, the native query language for semantic web data sources.


JDBC connects to data source based on a provided JDBC url. JDBC urls have the form

jdbc:data:world:[language]:[user id]:[dataset id]

where [language] is either "sql" or "sparql",[user id] is the id of the dataset owner, and [dataset id] is the identifier for the dataset.

Sample code (Java 8)
final String QUERY = "select * from HallOfFame where playerID = ? order by yearid, playerID limit 10"
final String URL = "jdbc:data:world:sql:dave:lahman-sabremetrics-dataset";
try (final Connection connection = // get a connection to the database, which will automatically be closed when done
             DriverManager.getConnection(URL, "<your user name>", "<your API token>");
     final PreparedStatement statement = // get a connection to the database, which will automatically be closed when done
             connection.prepareStatement(QUERY)) {
    statement.setString(1, "alexape01"); //bind a query parameter
    try (final ResultSet resultSet = statement.executeQuery()) { //execute the query
        ResultSetMetaData rsmd = resultSet.getMetaData();  //print out the column headers
        int columnsNumber = rsmd.getColumnCount();
        for (int i = 1; i <= columnsNumber; i++) {
            if (i > 1) System.out.print(",  ");
        while ( { //loop through the query results
            for (int i = 1; i <= columnsNumber; i++) { //print out the column headers
                if (i > 1) System.out.print(",  ");
                String columnValue = resultSet.getString(i);
Building dw-jdbc

dw-jdbc can be built from the command-line using mvn clean install.

Finding your Token

More resources for using Java/JVM/JDBC-enabled tools: