#2473 using sqlite

elyashiv Thu 24 Sep 2015

I'm trying to connect to sqlite database using fantom.

I run the following code:

fansh> using sql
Add using: using sql
fansh> db := SqlConn.open("jdbc:sqlite:test.db", "", "")

and I get the following error:

WARNING: Cannot preload JDBC driver: com.mysql.jdbc.Driver
sql::SqlErr: No suitable driver found for jdbc:sqlite:test.db
  sql::SqlConnImplPeer.err (SqlConnImplPeer.java:194)
  sql::SqlConnImplPeer.openDefault (SqlConnImplPeer.java:41)
  sql::SqlConnImpl.openDefault (SqlConnImpl.fan)
  sql::SqlConn$.open (SqlConn.fan:28)

Now, I'm not a expert, but I don't think I need to load com.mysql.jdbc.Driver to access a sqlite database which means I'm missing something.

Can someone help me?

SlimerDude Thu 24 Sep 2015

I've not used the sql pod myself but instructions on setting up SQL connections are given in the sql pod docs.

The sql pod is a wrapper around JDBC so yes you'll need a JDBC driver to use it for SQLite.

As for a suitable SQLite JDBC Driver - this one seems to be popular.

elyashiv Mon 28 Sep 2015

Sorry for the false alarm and thanks. I just didn't have the jar in the right place.

Login or Signup to reply.