Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Establish Connectivity between Java and SQLite

 
Nitin Agarwal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I m trying to establish connectivity between java and SQLite.

This is the code :




I have set Classpath for sqlite.jar file like :
java -cp E:\SQL Lite DB\sqlite.jar

It is giving error:
java.lang.ClassNotFoundException: SQLite.JDBC2y.JDBCConnection

I have opend jar file and see that this jar file contain package name JDBC2x and classes.
I have changed name of package to JDBC2y and make jar file and then use it but it is not working.

Please tell how can i get suitable jar file for this program. Tell me whole process for establishing connection between java and SQLite. Tell me some useful links for codes that establish connection between java and SQLite.

Please reply me in detail.

Thanks & Regards
Nitin

[edited to add line breaks]
[ December 15, 2005: Message edited by: Jeanne Boyarsky ]
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin,

I noticed you are struggling with this same problem on multiple forums. The advice given to you forums.java.sun.com still applies.

SQLLite is a embedded C library as such the JDBC drivers for it are type 2 in nature and require you to have native libraries installed in the appropriate places on your system.

Again as mentioned from version of the driver that you appear to be using you will need to actually make and compile the native parts yourself and then put them in the "right" directory as specified on the driver site.

Since you have been struggling with this for sometime now might I make two suggestions.

1) Could you possibly use another database? This embedded C will one take some voodoo to get going and I think there are lots of other solutions out there that would be less labour and expertise intensive.

2) If you have to use SQLLite I think you need to find someone who can help you out one on one and in person. Giving guidance to compile native libraries is not something that will be simple to do through only internet based guidance.
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could a moderator please edit the first post so that follow up posts in this thread are viewable. I can only see about two words per line on my screen at present.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Maximilian Stocker:
Could a moderator please edit the first post so that follow up posts in this thread are viewable. I can only see about two words per line on my screen at present.

Done
 
Nitin Agarwal
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Max,

That was most satisfying and best reply i have got from a forum.

Actually I m developing a desktop application in java swing on window 2003 server, i want to use lightweight database that can also run on Mac OS. Actually this application will be used on Mac OS. I find that SQLite DB is very light and fast.If u know any other database that is light,fast and easy to establish a connection with java so please suggest me.

Thanks for your cooperation

Nitin
 
stu derby
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Agarwal:
Hi Max,

If u know any other database that is light,fast and easy to establish a connection with java so please suggest me.




There are lots of better choices; for you the best one would be the Hypersonic DB, http://hsqldb.org/

It's pure Java, uses a type 4 driver, reasonably standards compliant, and best of all, can be used as either a standard "standalone" database, running outside your Java application, or can be embedded within it.

A good 2nd choice might be Apache's Derby (no relation to me).
http://db.apache.org/derby/

A good 3rd choice would be Postgres; a type 4 driver for the java side and a very good database. The downside is that you will need to buid and deploy the database yourself (I think). There are some good tutorials on doing this on the Macintosh; use Google.
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin,

I agree with Stu Derby. I think Hypersonic would be a good choice for you if you want something that is leightweight and portable across Mac and PC.

I have not had experience with Hypersonic but I have heard generally good things and there is a good user base both here and at the other forums so it will be easier for you to get help if you do run into any more questions.

But I do think that considering the need to work on cross-platforms a Java based embedded DB is a better way to go then an embedded C one.

Good luck to you and your project!

Max
 
Maximilian Xavier Stocker
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also.. welcome to Java Ranch Stu! Your expertise is certainly welcome here. For the rest of the forum denziens Stu is a regular in the JDBC forum on Sun and an invaluable source of knowledge on the subject particularly on issues regarding Oracle.

and finally thank you Jeanne for making this thread readable again.
[ December 15, 2005: Message edited by: Maximilian Stocker ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic