MIPS platform uses JDBC to operate the final solution for SQLite

Source: Internet
Author: User
Tags odbc sqlite sqlite database wrapper

1. Overview: This project needs to operate the embedded database SQLite on multiple platforms (MIPS must support), while the newest Sqlite-jdbc-3.15.1.jar Local drive contains only a small number of platforms, thus solving the support MIPS platform is really necessary. There are many ways to do this, specifically as follows.

1.1 SQLite three types of JDBC driver differences

Excerpted from http://blog.sina.com.cn/s/blog_654337ca01016x4n.html

in Dbeaver see SQLite has three kinds of JDBC driver, check their official website related explanation, found that they are quite different. SQLite Wrapper by christianhttp://www.ch-werner.de/javasqlite/This driver is actually packaged with the JDBC implementation on the local C + + SQLite. Size 100+k. Advantages: Small volume, fast speed disadvantage: rely on local sqlite drive SQLite zentus driverhttp://www.zentus.com/sqlitejdbc/This drive is a pure Java implementation of the SQLite database, Only this driver is required to operate the SQLite database files. Size 2.6M. Pros: No other dependency disadvantage: slower (pure Java implementation) SQLite xerial DRIVERHTTP://WWW.XERIAL.ORG/TRAC/XERIAL/WIKI/SQLITEJDBC This driver expands the Zentus version, And in the jar added Windows, Linux, Mac OS x three local SQLite drive library, so that four kinds of drivers coexist in the jar package. The goal is to automate the use of different local drivers in different operating systems (using a purely Java-driven driver in these three systems), ensuring no other dependencies and the fastest possible speed. But because it contains so many versions of the drive, it is larger and has a size of 3 m. Advantages: Fast speed, no other dependence disadvantage: large volume finally found,The Zentus Drive has not been updated since June 2009 (the latest version is based on SQLite3.6.14.2), and thexerial driver has not been updated since August 2010 ... SQLite Wrapper seems to have been updated, the current version is the February 2012. 1.2 SQLite xerial Driver Drive

    • Method 1: MIPS also use the local library, download source code compilation can. However, the compilation is very laborious, for the unit can not be connected to the machine, it simply does not work .

Source

    • Method 2: Use the JDBC Jdbc-odbc Bridge method.

First step: Load the driver (the role is to add the required driver to the memory)

Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver")

Step two: Get the connection (specify which data source to connect to), if you choose Windows NT authentication method when configuring the data source, you do not need to write out the user name and password

Connection ct=drivermanager.getconnection ("JDBC:ODBC: SimpleDB") If there is a user name and password, it is written after the data source.

The JDK has been removed from the Jdbc-odbc bridge since 1.8, so ODBC drivers are not available and it is recommended to reinstall jdk1.7 or lower versions. This scenario is OK, but the JDK version is strongly required to be lower than 1.7 or lower, which is not conducive to JDK upgrades.

Excerpt from http://blog.csdn.net/u011502222/article/details/44234103 (article titled java.lang.ClassNotFoundException: Sun.jdbc.odbc.JdbcOdbcDriver Solution! )

JDK7 and JDK8 do not seem to support Jdbc-odbc Bridge, so it's best to next version 6

Excerpted from Http://wenku.baidu.com/link?url=Tz8acJQlGCGQgejp7D4DJ0o_54AcohTmGm2c47Cy7X3y1nrLwyIap4pIuHnaVB_ 01WLFLTQ12NOHKIDCWMNLYVKASEEHGQGI-WJVOG1C0XK (article titled JDBC-ODBC Bridge Access tutorial )

    • Method 3: make SQLite with pure Java (applies to versions before 3.7.15) does not contain 3.7.15
Sqlite-jdbc-3.7.2.jar's

http://www.java2s.com/Code/Jar/s/Downloadsqlitejdbc372jar.htm of this project Sqlite-jdbc-3.7.2.jar is downloaded from this link because the link resources below are not unblocked .

Https://bitbucket.org/xerial/sqlite-jdbc/downloads?tab=tags

2, Sqlite-jdbc-3.15.1.jarSupported Operating Systems

Excerpted from HTTPS://BITBUCKET.ORG/XERIAL/SQLITE-JDBC

Since sqlite-jdbc-3.6.19, the natively compiled SQLite engines would be used for the following operating systems:

    • Windows XP, Vista (Windows, x86 architecture, x86_64)
    • Mac OS X 10.4 (Tiger), 10.5 (Leopard), 10.6 snowleopard (for i386, x86_64, Intel CPU machines)
    • Linux i386 (Intel), AMD64 (64-bit X86 Intel processor)

The other OSs isn't listed above, the Pure-java SQLite is used. (applies to versions before 3.7.15)

If you want the native library for your OS, [build the source from scratch. Compilation is cumbersome, and cross-platform is not good, to another platform need to continue to recompile

3. JDBC Connection using Sqlite-jdbc-3.7.2.jar operation database error: Java.sql.SQLException:out of memory, solution reference the following detailed description. Java SQLite out of memory exception

Excerpted from http://www.cnblogs.com/cnryb/archive/2012/06/13/2548445.html

I wrote something in SQLite today and eclips gave me this thing.

Out of memory

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 Com.loveoop.sqlite.Test.main (test.java:19)

Reason: Chinese is present in the directory structure,

Solution: Change Chinese to English ~ ~ ~.

Good luck!!

MIPS platform uses JDBC to operate the final solution for SQLite

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.