Java detailed process of connecting to the SQLite database using JDBC for various data operations

Source: Internet
Author: User

Java detailed process of connecting to the SQLite database using JDBC for various data operations

Preface:
SQLite is a ACID-compliant relational database management system, which is contained in a relatively small C library. It is a public project established by D. Richard IPP.
Unlike the common client-server example, the SQLite engine is not an independent process for communications between programs, but a major part of the connection to programs. Therefore, the main communication protocol is direct API calls in programming languages. This plays a positive role in total consumption, latency, and overall simplicity. The entire database (definition, table, index, and data itself) is stored in a single file on the host. Its simple design is completed by locking the entire data file at the beginning of a transaction.


1. Prepare the sqlite Data Source
Since sqlite is a memory database, there will also be a data file, essentially accessing a file, so you can copy the sqlite library file in linux to your laptop, then, access the sqlite library by calling the java program.

(1) install sqlite
: Wget http://www.sqlite.org/2014/sqlite-autoconf-3080403.tar.gz
Start installation:
Tar xvfz sqlite-autoconf-3080403.tar.gz
Cd sqlite-autoconf-3080403
./Configure -- prefix =/usr/local
Make
Make install

(2) Prepare the data source
[Root @ localhost sqlite-autoconf-3080403] # sqlite3 tim. db
SQLite version 3.8.4.3 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 -- 1 root 2048 Aug 29 tim. db
[Root @ localhost sqlite-autoconf-3080403] #

(3) Use the SecureFX tool to copy the tim. db data file to the root directory of the local disk, as shown in:




2. Start preparing the Eclipse Environment
Load jdbc jar package, jdbc jar package sqlitejdbc-v033-nested.jar, is:

 

------------------------------------------ Split line ------------------------------------------

 

Free in http://linux.bkjia.com/

 

The username and password are both www.bkjia.com

 

The specific download directory is in the/June/29th/Java detailed process of connecting to the SQLite database using JDBC for various data operations

 

For the download method, see

 

------------------------------------------ Split line ------------------------------------------

SQLite3 installation and basic operations

Simple Application of SQLite databases in Ubuntu 12.04

How to install SQLite in Ubuntu 12.04



Add it to the classpath system environment variable: Right-click the java project, select the last option Properties, select Java Build Path, and then select Libraries, then select Add External JARs ..., the local sqlitejdbc-v033-nested.jar package is then loaded, as shown in the path loading process:

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.