linux上 java 使用 javasqlite,linuxjavasqlite

來源:互聯網
上載者:User

linux上 java 使用 javasqlite,linuxjavasqlite
linux上 java 使用 javasqlite

http://www.ch-werner.de/javasqlite/

1) 下載:

http://www.ch-werner.de/javasqlite/javasqlite-20140624.tar.gz


2) 解壓後進入目錄編譯

$ cd javasqlite-20140624

$ ./configure

$ make


3) 拷貝libsqlite_jni.so到/usr/lib64目錄

$ sudo cp .libs/libsqlite_jni.so /usr/lib64

如果上一步不執行,會報錯誤:

Unable to load sqlite_jni: java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path


4) 匯入sqlite.jar到java項目中


5) 使用sqlite java wrapper:

import SQLite.Database;

...

Database db = new Dababase();

db.open(dbFile, SQLite.Constants.SQLITE_OPEN_READWRITE |
                SQLite.Constants.SQLITE_OPEN_CREATE |
                SQLite.Constants.SQLITE_OPEN_FULLMUTEX);

db.exec("create table ...", null);

開啟sqlite db參考:

http://blog.csdn.net/yifanernei/article/details/5642127

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.