Forum: Building VoltDB Clients

Post: Testing JDBC connection with SQLLine

Testing JDBC connection with SQLLine
Marina
Feb 23, 2015
Hi,
I wonder if it is possible to establish the connection to VoltDB database via JDBC using the tools like SQLLine (or some other?) ?
When I enter the command on sqlline:
!connect jdbc:voltdb://myvoltdbhost:21212 user1 passw1

I receive an error:
Error: (state=,code=0)

Any thoughts?

Thanks in advance for any response.
jpiekos
Feb 25, 2015
I'm not familiar with SQLLine, but we've successfully run tools such as DBVisualizer and SQuirreL. Check out our voter JDBC sample in the kit for a working example of JDBC: https://github.com/VoltDB/voltdb/blob/master/examples/voter/client/voter/JDBCBenchmark.java

John
Marina
Feb 25, 2015
John,
Thank you.
The readme.md file conatins:
2. Type "voltdb create" to start an empty, single-node VoltDB server.
3. Type "sqlcmd < ddl.sql" to load the schema and the jarfile of procedures into VoltDB.
I am using Linux. I guess the step # 3 should NOT be on the same Linux session. Correct? Could you please clarify this step?

Also, I am running my JDBC (client) connection on the Windows box. Which of the steps listed in the readme.md should I perform on the Windows box?

Thanks in advance.
jpiekos
Feb 25, 2015
Step 3 can be run on the same Linux box, but on a separate terminal window. Or you can run the "voltdb create" in the background ("voltdb create --background" will do it) and run sqlcmd from the same command window after the database has started successfully as a background process.

So all those steps can be done on Linux. Once the database is started, you can connect to it via JDBC from any other tool/process. Note that you will need the voltdb client jar file (it has the VoltDB JDBC driver) available to the process running JDBC.

John