Port SQLite on micro

Source: Internet
Author: User

Next we will talk about the migration of SQLite on micro.

Steps:

1. compile a database suitable for arm

1. Download The SQLite source code package. URL: http://www.sqlite.org/

2. decompress the source code package.

[Root @ localhost SQL] # tar-zxvf SQLite.tar.gz

3. Enter the directory.

[Root @ localhost SQL] # cd SQLite
4. Create a build directory and enter. PS: This directory is used for cross-compilation.

[Root @ localhost build] # mkdir build
[Root @ localhost build] # cd build/

5. Run the configuration program in the build directory.

[Root @ localhost build] # ../configure -- host = arm-linux -- prefix =/myworkspace/SQL/SQLite/build/target

.... Start to configure ....

PS: if you are not clear about these options, you can./configure -- help (in the source code directory, or write the absolute path ).

6. Execute the make and make install commands for compilation and installation.

[Root @ localhost build] # make & make install

.... Start compilation and installation ....

(I have not encountered any errors here. If any compilation error occurs, we will study it together )...)

After completion, there will be three directories in the target directory under your build directory:

[Root @ localhost target] # ls
Bin include lib

This will not be explained.

2. database migration

1. Put the bin and lib directories under the target file in a new SQLite directory.

2. Next, you can get the SQLite directory to your development board without any means, and then add environment variables.

[Root @ localhost target] # vim/etc/profile PS: You can also use vi here, but I made an alias

Add the following two lines to the file:

Export PATH =/SQLite/bin: $ PATH
Export LD_LIBRARY_PATH =/lib: $ LD_LIBRARY_PATH

The restart takes effect.

Iii. Test

[Root @ FriendlyARM/] # sqlite3 file. db
SQLite version 3.7.15 2012-12-10 22:19:14
Enter ". help" for instructions
Enter SQL statements terminated with ";"
Sqlite> create table file (number, name );
Sqlite> insert into file values (1, 'bin ');
Sqlite> insert into file values (2, 'lib ');
Sqlite> select * from file;
1 | BIN
2 | LIB
Sqlite>. quit
[Root @ FriendlyARM/] #

You have created a file database and inserted two records. The query result is correct. It means that your database is done. Next, go to program control!

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.