The error "no SQLite library found" means that neither the native nor
nested sqlitejdbc driver was found in your classpath.

Your application must also have this line before you try to establish
a JDBC connection so JDBC can find the driver:

   Class.forName("org.sqlite.JDBC");

Forget about the native driver for the moment.
Just grab sqlitejdbc-v036-nested.jar from the tar file on the website and 
put it in the same directory as Foo.java (below) and repeat these steps 
on UNIX:

$ cat Foo.java
import java.sql.*;
public class Foo {
  public static void main(String[] args) throws Exception {
    try {
      Class.forName("org.sqlite.JDBC");
      final Connection con = DriverManager.getConnection("jdbc:sqlite:");
      Statement st = con.createStatement();
      st.executeUpdate("CREATE TABLE FOO (a,b,c)");
      st.executeUpdate("INSERT INTO FOO VALUES(123, 'dog', 67.89)");
      st.executeUpdate("INSERT INTO FOO VALUES(345, 'cat', 8.349)");
      st.executeUpdate("INSERT INTO FOO VALUES(789, 'pig', -44.5678)");
      ResultSet rs = st.executeQuery("SELECT a, b, c FROM FOO");
      while (rs.next()) {
        int    a = rs.getInt("a");
        String b = rs.getString("b");
        double c = rs.getDouble("c");
        System.out.println("a = " + a + ", b = " + b + ", c = " + c);
      }
    } catch (Exception e) { e.printStackTrace(); }
  }
}

$ javac -classpath sqlitejdbc-v036-nested.jar Foo.java
$ java -cp sqlitejdbc-v036-nested.jar:. Foo
a = 123, b = dog, c = 67.89
a = 345, b = cat, c = 8.349
a = 789, b = pig, c = -44.5678

If you get these results - you have a working JDBC driver.

On Windows you would use:

  java -cp sqlitejdbc-v036-nested.jar;. Foo

Now for the native driver, on UNIX, copy the .so to the current directory
and run this:

  LD_LIBRARY_PATH=. java -cp sqlitejdbc-v036-native.jar:. Foo



       
____________________________________________________________________________________
Looking for a deal? Find great prices on flights and hotels with Yahoo! 
FareChase.
http://farechase.yahoo.com/

--~--~---------~--~----~------------~-------~--~----~
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to