Installing SQLite on your FOX board

Get your FOX board a SQL database engine.

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.

SQLite is the most widely deployed SQL database engine in the world.
It is used in countless desktop computer applications as well as consumer electronic devices including cellphones, PDAs, and MP3 players.
The source code for SQLite is in the public domain.

http://www.sqlite.org/
http://www.capefox.com/howto/CompilingtheSQLiteengineforFox.htm
http://hw.cz/produkty/obecne-produkty/art1794-fox-board-sqlite-tlm-20-pristupovy-system.html

1. On your Virtual Terminal

Install the Axis SDK on your Linux box and go to the /home/fox/devboard-R_01 directory and type:

# . init_env
  Prepending "/..../devboard-R2_01/tools/build/bin" to PATH.
  Prepending "/usr/local/cris/bin" to PATH.
# cd apps

Download the SQLite software:

# mkdir sqlite-3.2.2
# cd sqlite-3.2.2
# wget http://www.myfoxboard.co.nr/sqlite-source-3_2_2.tar
# tar -xvf sqlite-source-3_2_2.tar 

The only bit to watch out for is the location of the sqlite3.so file on the Fox board itself.
Ultimately it'll be in /usr/lib, but during development it'll be in /usr/local/lib, or /mnt/flash.
So in the Makefile_so and Makefile_sh change the following line:

LDFLAGS += -Wl,-R/usr/local/lib
into
LDFLAGS += -Wl,-R/mnt/flash

1.1 Installing the SQLite3 library

# cp Makefile_so Makefile
# make cris-axis-linux-gnu
# make
# make install

Now to use this library you have to transfer it on the FOX board. The easiest way is to use SCP:

# scp sqlite3.so root@192.168.1.90:/mnt/flash

1.2 Installing the SQLite3 shell

# cp Makefile_sh Makefile
# make cris-axis-linux-gnu
# make
# make install

Now to use this shell you have to transfer it on the FOX board. The easiest way is to use SCP:

# scp sqlite3shell root@192.168.1.90:/mnt/flash

2. On your FOX Board

Now open a terminal session to the Fox board itself, and go to the /mnt/flash directory.

Don't forget to set the execute permissions in the /mnt/flash by doing

# chmod +x sqlite3shell

and then you can run it by doing

# ./sqlite3shell

You should see something like this:

SQLite version 3.2.2
Enter ".help" for instructions
sqlite>

Dump a database:

# ./sqlite3shell MySunData.db3
SQLite version 3.2.2
Enter ".help" for instructions
sqlite> .databases
seq  name             file
---  ---------------  ----------------------------------------------------------
0    main             /mnt/flash/MySunData.db3
sqlite> .dump MySunData
BEGIN TRANSACTION;
CREATE TABLE [MySunData] (
  [Date] DATETIME,
  [Watt] CURRENCY);
INSERT INTO "MySunData" VALUES('2008-01-09 06:00:00.000', 15.3);
INSERT INTO "MySunData" VALUES('2008-01-09 07:00:00.000', 20);
INSERT INTO "MySunData" VALUES('2008-01-09 08:00:00.000', 66);
INSERT INTO "MySunData" VALUES('2008-01-09 09:00:00.000', 99);
INSERT INTO "MySunData" VALUES('2008-01-09 10:00:00.000', 54);
INSERT INTO "MySunData" VALUES('2008-01-09 12:00:00.000', 23);
INSERT INTO "MySunData" VALUES('2008-01-09 14:00:00.000', 2);
INSERT INTO "MySunData" VALUES('2008-01-10 02:00:00.000', 15);
INSERT INTO "MySunData" VALUES('2008-01-10 04:00:00.000', 17);
INSERT INTO "MySunData" VALUES('2008-01-10 06:00:00.000', 26);
INSERT INTO "MySunData" VALUES('2008-01-10 07:00:00.000', 3);
COMMIT;
sqlite>

# ./sqlite3shell MySunData.db3  "select * from MySunData"
2008-01-09 06:00:00.000|15.3
2008-01-09 07:00:00.000|20
2008-01-09 08:00:00.000|66
2008-01-09 09:00:00.000|99
2008-01-09 10:00:00.000|54
2008-01-09 12:00:00.000|23
2008-01-09 14:00:00.000|2
2008-01-10 02:00:00.000|15
2008-01-10 04:00:00.000|17
2008-01-10 06:00:00.000|26
2008-01-10 07:00:00.000|3


Hit Counter by Digits