1 Reply Latest reply: Apr 27, 2008 7:52 AM by 843807 RSS

    no SQLite library found

    843807
      Hello, im trying to connect a SLIte library, using Eclipse.
      My simple Code is working in Eclipse, but after compiling it to jar i get the
      "no SQLite library found" Error.
      I have "sqlitejdbc-v038-native.jar" and "sqlitejdbc.dll" in my class-path.

      Manifest File:
      Manifest-Version: 1.0
      Main-Class: Database.DBEmbedded
      Class-Path: sqlitejdbc-v038-native.jar
      Do Someone have some expirience with this Problem?
      package Database;
      
      import java.sql.*;
      
      import javax.swing.JOptionPane;
      import javax.swing.JPanel;
      
      import org.sqlite.JDBC;
      
      public class DBEmbedded {
           
           private static final String Database = "SQLiteDB.db";
           
          public static void main(String[] args) throws Exception {
               
               
               NewTable("Test23");
               InsertFull("Test23","Artikelnummer","Name", "Abeschr", "UVMenge", "Datensatznummer"," Datenerfasser", "ADatum", "Lieferant", "UVEinheit", "APreis", "Bemerkungen");
               
              Class.forName("org.sqlite.JDBC");
              Connection conn = DriverManager.getConnection("jdbc:sqlite:"+Database);
              
              Statement stat = conn.createStatement();
      
              rs.close();
              conn.close();
          }
      
      
      public static boolean NewTable(String Name){
               try{
                    Class.forName("org.sqlite.JDBC");
                  Connection conn = DriverManager.getConnection("jdbc:sqlite:"+Database);
                  Statement stat = conn.createStatement();
                  stat.executeUpdate("create table "+Name+" (Artikelnummer,Name,Abeschr,UVMenge,Datensatznummer,Datenerfasser,ADatum,Lieferant,UVEinheit,APreis,Bemerkungen);");
                  conn.close();
                  System.out.println("Created "+Name);
                    return true;
               }
               catch(Exception e){
                    
                    //Exception Pop-up Message
                    JOptionPane.showMessageDialog( 
                               //?? does it create new Panel every time maybe i t can create 1000 panels and block the RAM 
                               new JPanel(), 
                               "Creation Failed.\n Exception: "+e, 
                               "Bum", 
                              JOptionPane.WARNING_MESSAGE 
                              
                          ); 
                    return false;
               }
      
      
      public static boolean InsertFull(String Table,String Artikelnummer,String Name,String Abeschr,String UVMenge,String Datensatznummer,String Datenerfasser,String ADatum,String Lieferant,String UVEinheit,String APreis,String Bemerkungen){
               try{
                    Class.forName("org.sqlite.JDBC");
                  Connection conn = DriverManager.getConnection("jdbc:sqlite:"+Database);
                  Statement stat = conn.createStatement();
                  stat.executeUpdate("insert into "+Table+" values ('"+Artikelnummer+"','"+Name+"','"+Abeschr+"','"+UVMenge+"','"+Datensatznummer+"','"+Datenerfasser+"','"+ADatum+"','"+Lieferant+"','"+UVEinheit+"','"+APreis+"','"+Bemerkungen+"');");
                  conn.close();
                  System.out.println("Inserted into  "+Table+" and Artikelnummer "+Artikelnummer);
                    return true;
               }
               catch(Exception e){
                    //Exception Pop-up Message
                    JOptionPane.showMessageDialog( 
                               //?? does it create new Panel every time maybe i t can create 1000 panels and block the RAM 
                               new JPanel(), 
                               "Failed to Insert.\n Exception: "+e, 
                               "Bum", 
                              JOptionPane.WARNING_MESSAGE 
                              
                          ); 
                    return false;
               }
          }
        • 1. Re: no SQLite library found
          843807
          Hi, I had the same error, I think it means that it can't find the DLL file that comes with the native driver.
          So I found three solutions:
          1) (FROM THE WEBSITE) Run with: java -cp .:sqlitejdbc-v***-native.jar -Djava.library.path=. Test
          2) Use the driver from: http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC
          3) Use the Nested driver (not so efficient).