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!