开发者

eclipse java how to had sqlite-jdbc-(VERSION).jar into my project and use it

my scenario : on my work on android sqlite i noticed I need to build the sql data base outside the app in java

therfor as one who knows nothing about how to install ***.jar files i google it all the example for how to install it weren't relevant for my situation where my platform is eclipse in windows 7 .

i would someone to instract me how to do the fallowing

  • i have downloaded sqlitejdbc-v056 and no开发者_如何学Cw i wish to append it to my project
  • how can I open a new data base , can i do :

     Class.forName("sqlitejdbc-v056");
    Connection conn = DriverManager.getConnection("jdbc:sqlite:C:/Users/STERN/workspace/Test1/src/notexistyet.db");
    

    where notexistyet doesnt exist and by writing the last it will b created

thank u.


As far as i understand, you need to add sqlitejdbc-v056.jar to your Libraries (build path) so that you can use the jar file.

Right click on your Eclipse Project->Build Path->Configure Build Path...->Add External Jar (under libraries)

Browse to the JAR file and add it.

Then this will work:

    Class.forName("org.sqlite.JDBC");
    Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");

Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜