Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connect to SQLite db through eclipse

843859May 17 2010 — edited Nov 20 2014
Hello,
I want to connect my app to an SQLite db. I downloaded driver and the .jar from : http://www.ch-werner.de/javasqlite/
For testing purposes i try to run this code:
package com.javaworkspace.connectsqlite;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


public class ConnectSQLite {
	public static void main(String[] args) {

		Connection connection = null;
		ResultSet resultSet = null;
		Statement statement = null;

		try {
			Class.forName("org.sqlite.JDBC");
			connection = DriverManager
					.getConnection("jdbc:sqlite:/EMPLOYEE.db");
			statement = connection.createStatement();
			resultSet = statement
					.executeQuery("SELECT EMPNAME FROM EMPLOYEEDETAILS");
			while (resultSet.next()) {
				System.out.println("EMPLOYEE NAME:"
						+ resultSet.getString("EMPNAME"));
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				resultSet.close();
				statement.close();
				connection.close();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
Now what i don't get is where to put the files:
sqlite_jni.dll (located in: download file->j2sdk1.4.2_03->jre->bin)
sqlite.jar (located in: download folder->j2sdk1.4.2_03->jre->lib->ext)

So where to put them and how to implement them to my eclipse project with the code above.
And if it is important, i use ubuntu.

Thank you, and i'm sorry i bother you with my newbie questions...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 14 2010
Added on May 17 2010
1 comment
859 views