tags:

views:

58

answers:

1

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 now 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.

A: 

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

Bonus Tip: When you see an answer which makes you feel YES! this might be a correct answer, then Accept that answer as the correct answer by Clicking on the Tick Mark (which will turn green) beside the corresponding answer.

Benefits of accepting an answer:

  1. More people will answer your questions

  2. You will receive 2 points for accepting

Your 0% accept rate is not really acceptable.

zengr