Forum: Other

Post: How to connect VoltDB with JDBC?

How to connect VoltDB with JDBC?
Jan 14, 2014
Hi everyone,

I'm testing VoltDB simply how it just works in my environment.
I'm trying out VoltDB via load testing tool, JDBCRunner with the simple test script below.
Yet I am not sure how to connect the tool to VoltDB.

var jdbcDriver = "org.voltdb.jdbc.Driver";
var jdbcUrl = "jdbc:voltdb://IP Addr.:Port";
//var jdbcUser = "test";
//var jdbcPass = "test";

function run() {
var param = random(1, 5);
query("SELECT data FROM tutorial WHERE id = $int", param);

I installed VoltDB, and created the sample data table according to the Tutorial guide.
Then complied the schema file and start VoltDB.
When I execute simple script via JDBC, some error appears as below.

===================Error message========================
Exception in thread "agent0" java.lang.NoClassDefFoundError: com/google ase/Supplier
at org.voltdb.client.Distributer.<init>(
at org.voltdb.client.ClientImpl.<init>(
at org.voltdb.client.ClientFactory.createClient(ClientFactory.j
at org.voltdb.jdbc.JDBC4ClientConnection.<init>(JDBC4ClientConn va:138)
at org.voltdb.jdbc.JDBC4ClientConnectionPool.get(JDBC4ClientCon
at org.voltdb.jdbc.Driver.connect(
at org.apache.commons.dbcp.DriverConnectionFactory.createConnec
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFa
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnec ry(
at org.apache.commons.dbcp.BasicDataSource.createDataSource(Bas
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicD .java:1044)
at jdbcrunner.Manager.getConnection(
at jdbcrunner.Agent.callInit(
Caused by: java.lang.ClassNotFoundException:
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
... 16 more

It seems that JDBC Driver doesn't work.
Yet I have already set jar file, and CLASSPATH.
(CLASSPATH=/****/voltdbclient-3.7.jar )

Does anyone have ideas?

Sorry for my newbie question.

Environment (VM)
RHEL 6.3, CPU 2GHz 4 core, Memory 8GB
Jan 14, 2014
Hi Louis,

In VoltDB 3.7, you need to include the guava-12.0.jar file in your CLASSPATH for java clients using either the native java client library or the JDBC driver. The file is provided in the kit under lib/guava-12.0.jar. For VoltDB 4.0, which will be available to the public for download later this month, the guava library has been embedded into the JDBC driver file so there are no external dependencies.

Jan 15, 2014
Hi Ben,

It went well.
I appreciate your advice.

- Louis
Jul 9, 2014
i am confused in jdbc driver. What type of jdbc driver is using? Can you give me direct link download jdbc driver?
Jul 9, 2014

Jdbc driver is now included in our server/client kit, specifically voltdb/voltdbclient-n.n.jar for the client. An example of its use can be found in examples/voter.
Here is documentation of JDBC interface on our website:
If you have any other questions, feel free to reach out to us.