mercredi 6 janvier 2016

How to give Connection String for Sql lite database?

First of all i would like to tell my apologies for asking this simple question. i am trying to connect sql-lite database table.I am using following code.

package derb;
import java.sql.*;
public class db {
    public static void main(String[] args) throws Exception {
        Class.forName("org.sqlite.JDBC");
        Connection con=DriverManager.getConnection("jdbc:sqlite:/home/anand/MySQLiteDB.TEST","root","ROOT");
        Statement st=con.createStatement();
        String q="insert into CHECKING values(3)";
        st.executeUpdate(q);
    }

}

TEST is my database and i created one table called CHECKING in eclipse.but in above code gives me the error

Exception in thread "main" java.sql.SQLException: no such table: CHECKING
    at org.sqlite.DB.throwex(DB.java:288)
    at org.sqlite.NativeDB.prepare(Native Method)
    at org.sqlite.DB.prepare(DB.java:114)
    at org.sqlite.Stmt.executeUpdate(Stmt.java:102)
    at derb.db.main(db.java:9)

I manually checked in the eclipse the table was available.but i don't know how to make the connection to that table.So any one can help me to fix this

Thank you

Aucun commentaire:

Enregistrer un commentaire