(1),安装sqlite 下载地址: Wget http://www.sqlite.org/2014/sqlite-autoconf-3080403.tar.gz 开始安装: tar xvfz sqlite-autoconf-3080403.tar.gz cd sqlite-autoconf-3080403 ./configure --prefix=/usr/local make make install
(2),准备数据源 [root@localhost sqlite-autoconf-3080403]# sqlite3 tim.db SQLite version 3.8.4.3 2014-04-03 16:53:12 Enter ".help" for usage hints. sqlite> .table sqlite> create table t1(id int); sqlite> insert into t1 select 1; sqlite> .exit [root@localhost sqlite-autoconf-3080403]# ll tim.db -rw-r--r-- 1 root root 2048 Aug 29 09:34 tim.db [root@localhost sqlite-autoconf-3080403]#
四,调试运行: (1),第一次调试报错如下: Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169)
(2),再运行报错如下: jdbc:sqlite://E:/u/sqllite/db/powerlong_208.db java.sql.SQLException: out of memory at org.sqlite.DB.throwex(DB.java:252) at org.sqlite.NestedDB.open(NestedDB.java:47) at org.sqlite.Conn.<init>(Conn.java:36) at org.sqlite.JDBC.connect(JDBC.java:38) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at foo.Main.main(Main.java:41)