Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-20-2008, 08:17 PM
Member
 
Join Date: Mar 2008
Posts: 2
mark8569 is on a distinguished road
JAVA and SQLite
Hello,
I am trying to get java to work with SQlite using the following code:

import java.sql.*;

public class Main {

public static void main(String[] args) throws Exception {
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db") ;
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery("SELECT Question, Answer, Type FROM Questions");
while (rs.next()) {
System.out.println(rs.getString("1"));
System.out.println(rs.getString("2"));
System.out.println(rs.getString("3"));
}
rs.close();
conn.close();
}
}

But when I try to compile I keep getting the exception:

Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC

I have looked around other forums and I think I have downloaded the correct drivers for the SQLiteJDBC:
sqlitejdbc-v043-native.jar and sqlitejdbc.dll from SQLite JDBC Driver.

I have read that these files need to be put on the classpath and the java library paths respectively however I am unsure how to do this. Also if I do manage to get these files onto their paths would the same have to be done on every computer that I want to run this program on?

Many thanks

Mark
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to get JAVA to work with SQLite mark8569 Database 0 03-20-2008 05:48 PM


All times are GMT +3. The time now is 09:53 AM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org