On linux, java uses javasqlite and linuxjavasqlite.

Source: Internet
Author: User
Tags sqlite db

On linux, java uses javasqlite and linuxjavasqlite.
Use objective qlite in java on linux

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

1) download:

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


2) decompress the package and enter the directory for compilation.

$ Javasqlite-20140624 cd

$./Configure

$ Make


3) Copy libsqlite_jni.so to the/usr/lib64 directory.

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

If the previous step is not executed, an error is returned:

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


4) import sqlite. jar to the java project.


5) Use 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.exe c ("create table...", null );

To open sqlite db, refer:

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.