This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
java_introduction [2015/06/09 14:02] Joel Dare [SQLite Library] |
java_introduction [2015/06/09 14:03] Joel Dare [Using Libraries] |
||
---|---|---|---|
Line 56: | Line 56: | ||
I believe the colon (:) and semi-colon (;) are separators while the dot (.) indicates the current directory. | I believe the colon (:) and semi-colon (;) are separators while the dot (.) indicates the current directory. | ||
+ | |||
+ | Here's a full example of our Application.java file loading in the SQLite-jdbc library and using it. | ||
+ | |||
+ | <code> | ||
+ | import java.sql.*; | ||
+ | |||
+ | public class Application { | ||
+ | |||
+ | public static void main(String[] args) { | ||
+ | |||
+ | Connection c = null; | ||
+ | try { | ||
+ | Class.forName("org.sqlite.JDBC"); | ||
+ | c = DriverManager.getConnection("jdbc:sqlite:hello.db"); | ||
+ | } catch ( Exception e ) { | ||
+ | System.err.println( e.getClass().getName() + ": " + e.getMessage() ); | ||
+ | System.exit(0); | ||
+ | } | ||
+ | System.out.println("Opened database (hello.db) successfully"); | ||
+ | |||
+ | } | ||
+ | |||
+ | } | ||
+ | </code> |