Thin JDBC driver for the SlamData Engine, supporting query execution by connecting to the SlamData Engine.
Note: Requires Java 7.
git clone git@github.com:slamdata/slamengine.git
Run the tests and assemble the driver and its dependencies into a single jar:
sbt assembly
The SlamData Engine API server must be running and accessible via the network. See slamdata/slamengine.
You open a connection using a URL made up of the scheme slamengine
, the
host name and port of the SlamData server, and the path within the SlamData
filesystem where your source files are found.
For example slamengine://localhost:8080/test/
.
Add slamengine-jdbc_2.11-0.1-SNAPSHOT.jar
to your classpath.
import java.sql.*;
...
Driver driver = new slamdata.jdbc.SlamDataDriver();
Connection cxn = driver.connect("slamengine://localhost:8080/test/", null);
try {
Statement stmt = cxn.createStatement();
ResultSet rs = stmt.executeQuery("select * from zips");
while (rs.next()) {
for (int i=1; i <= rs.getColumnCount(); i++) {
if (i > 1) System.out.print("; ");
System.out.print(rs.getString(i));
}
System.out.println();
}
}
finally {
cxn.close();
}
Note: error handling and resource cleanup elided above.
Configure your tool to use slamengine-jdbc_2.11-0.1-SNAPSHOT.jar
.
Open a connection with a URL like http://localhost:8080/test/
.
Run queries...
Copyright © 2014 - 2015 SlamData Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014-2015 SlamData Inc.