Trying to create new database on connection

74 views
Skip to first unread message

Jonathan Schmidt

unread,
Apr 25, 2013, 4:51:43 PM4/25/13
to xer...@googlegroups.com
I am trying to create a database in an embedded java program with the following code:

           String dbName = "testdb";
           String driver = "org.sqlite.JDBC";
           String connectString = "jdbc:sqlite::memory:"   (i have also tried "jdbc:sqlite:")
              try
              {
                 Class.forName(driver);
                 System.out.println(driver + " Started");
              }
              catch (java.lang.ClassNotFoundException e)
              {
                 System.err.print("ClassNotFoundException: ");
                 System.err.println(e.getMessage());
                 System.out.println("\n    >>> Please check your CLASSPATH variable   <<<\n");
              }

              try
              {
                  System.out.println("Connecting: " + connectString);
                 conn = DriverManager.getConnection(connectString);
                 System.out.println("Database booted...");

                 s = conn.createStatement();

              }
              catch (Throwable e)
              {
                 System.out.println("Error connecting to database:  " + e);
              }

I get a successful "org.sqlite.JDBC Started" printout
but when it comes to the connection I get:
"Error connecting to Database: java.lang.IncompatibleClassChangeError: class java.lang.reflect.Constructor does not match its skeleton"

Any ideas?

I am running on PERC JVM and have tried version 1.5, 1.6 and 1.7 with no luck.

Peter Borissow

unread,
Apr 25, 2013, 5:39:50 PM4/25/13
to xer...@googlegroups.com
I assume you're using the latest snapshot. If so, I think the url is a little off. You need ":file" like this:

jdbc:sqlite:file::memory:?cache=shared



From: Jonathan Schmidt <jdsc...@gmail.com>
To: xer...@googlegroups.com
Sent: Thursday, April 25, 2013 4:51 PM
Subject: [xerial 686] Trying to create new database on connection

--
You received this message because you are subscribed to the Google Groups "Xerial" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xerial+un...@googlegroups.com.
To post to this group, send email to xer...@googlegroups.com.
Visit this group at http://groups.google.com/group/xerial?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


Jonathan Schmidt

unread,
Apr 26, 2013, 11:18:52 AM4/26/13
to xer...@googlegroups.com, Peter Borissow
Thanks for the info. I was just going off the defaults they used int he documentations (and yes I'm using the latest snapshot)
I tried that and got:

org.sqlite.JDBC Started
Connecting: jdbc:sqlite:file::memory:?cache=shared
Error connecting to database:  java.sql.SQLException: opening db: 'file::memory:
?cache=shared': Invalid oflag or omode argument.

Jonathan Schmidt

unread,
Apr 26, 2013, 11:23:35 AM4/26/13
to xer...@googlegroups.com, Peter Borissow
Nevermind... I realized I had my import statements messed up. Thanks!
Reply all
Reply to author
Forward
0 new messages