Simple client local file database SQLite

Source: Internet
Author: User
Tags ibm db2

ToProgramSave some data (the database is large and there are many categories), and you do not want to use files, because it is not easy to search and operations are also troublesome. So I went to a lightweight file database and looked at it. I checked several types of databases first. 1. Berkeley dB (open-source, charged under some conditions, and expensive) 2. SQLite (open-source, completely free), Berkeley dB does not support standard SQL, so it is not suitable to use. SQLite not only supports standard SQL, but also can be used on multiple platforms, especially on embedded platforms, (Linux/wndows/wince. etc .), gdbm/jdbm databases are simple, but the operations are in the form of hashtable, and the data retrieval capability is limited. Now, SQLite actually has c interfaces, Java interfaces, and Java JDBC interfaces, god and man, there is no reason not to choose.

Go to http://www.sqlite.org/.to download SQLite DLL and database management software. They are very small, and this is a high person.

Download JDBC from http://www.ch-werner.de/javasqlite/javasqlite-20080420-win32.zip

Load these things into eclipse, according to The JDBC usage method,

Class. forname ("SQLite. jdbcdriver"). newinstance ();

Connection conn = drivermanager. getconnection ("JDBC: SQLite:/test. SDB ");

Statement SMT = conn. createstatement ();

Resultset rst = smt.exe cutequery ("select * From tbl_user ");

If (RST. Next ())

{

String user_name = RST. getstring ("user_name ");

System. Out. println (user_name );

};

OK. Very simple,

Of course. Test. SDB. Use the SQLite management tool you just downloaded to create a table.

In addition, the sqlite_ini.dll file should be placed under JDK/JRE's JRE/bin. To facilitate release to other machines, you should put it under the same directory where the main class file is executed, or press classpath.

If you have time next week, try again to learn how to use SQLite in VC is better than access.

BTW:

Some common file databases:

Cloudscape (http://www-306.ibm.com/software/data/cloudscape/download) from IBM. Oracle seems to have a mobile light database named Oracle 9i Lite.

Hsql is fully written in Java, and some support JDBC runs on the personal Java and FP/PP platforms, but it cannot provide a solution for MIDP (general mobile phone j2s). Unfortunately! But check whether the new version supports MIDP devices.

Pointbase micro is also written by Java to run FP/PP/personal Java and MIDP platforms. It provides lightweight jdbcapi-like tools and can also use unisync to synchronize data with other databases (such as Oracle. Unfortunately, you have to pay for it.

Sybase ianywhere

IBM DB2 everyplace

 

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.