Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /****[SOURCE CODE]*****/
- import java.sql.Connection;
- import java.sql.DriverManager;
- public class SQLiteJDBC {
- public static void main( String args[] ) {
- Connection c = null;
- try {
- Class.forName("org.sqlite.JDBC");
- c = DriverManager.getConnection("jdbc:sqlite:$lokasidb");// $lokasidb = lokasi database ex : /home/qnoy/sqlite_folder/testqq.db
- } catch ( Exception e ) {
- System.err.println( e.getClass().getName() + ": " + e.getMessage() );
- System.exit(0);
- }
- System.out.println("Opened database successfully");
- }
- }
- tested with :
- sqlite3 : 3.21.0
- java : openjdk version 1.8.0_151
- codding with :
- BlueJ : v4.1.2
- REF :
- http://www.sqlitetutorial.net/sqlite-java/sqlite-jdbc-driver/
- https://www.tutorialspoint.com/sqlite/sqlite_java.htm
- https://bitbucket.org/xerial/sqlite-jdbc/downloads/
Advertisement
Add Comment
Please, Sign In to add comment