4 This is an open source ODBC driver for the wonderful
\r
5 SQLite 2.8.* and SQLite 3.* Database Engine/Library.
\r
6 The driver is usable but may contain lots of memory
\r
7 leaks and all other kinds of bugs. Use it on your own
\r
10 The current source can be downloaded from
\r
12 http://www.ch-werner.de/sqliteodbc/sqliteodbc-*.tar.gz
\r
14 WIN32 binaries (the ODBC driver DLL, install/uninstall programs) are in
\r
16 http://www.ch-werner.de/sqliteodbc/sqliteodbc.exe
\r
18 The binaries were made with SQLite 2.8.17, SQLite 3.7.8, MingW
\r
19 cross compiler and tested on Windows NT 4.0 with the query tool
\r
20 of MS Excel 97, with StarOffice 5.2 and OpenOffice 1.1 and 2.x.
\r
21 Execute the sqliteodbc.exe NSIS installer to unpack the necessary
\r
22 files. This installs the SQLite ODBC driver and creates a System DSN.
\r
23 To remove the driver use the start menu entries or the UNINST.EXE
\r
24 program. To create a SQLite data source use the ODBC control panel
\r
25 applet and provide the name of the SQLite database file to be worked
\r
26 on as an absolute pathname including the drive letter, eg as
\r
27 "C:\TEMP\SQLite.DB". The busy (or lock) timeout for the database
\r
28 can be specified in the respective field. If empty a default value
\r
29 of 100000 milliseconds is used.
\r
31 The Win64 installer (sqliteodbc_w64.exe) was made with SQLite 3.7.8,
\r
32 MingW cross compiler and only rudimentary tested on Windows Vista 64.
\r
34 Other tests were made on Linux with the "isql" command line tool
\r
35 and the "DataManager" GUI tool of unixODBC 2.1.0.
\r
38 Since October 14th, 2001, the driver supports the data types SQL_INTEGER,
\r
39 SQL_TINYINT, SQL_SMALLINT, SQL_FLOAT, SQL_DOUBLE, SQL_DATE, SQL_TIME,
\r
40 SQL_TIMESTAMP, and SQL_VARCHAR.
\r
42 Since May 25th, 2002, SQL_LONGVARCHAR is available but rather
\r
43 experimental. That type is used for SQLite schema containing text
\r
44 or varchar with a size specifier larger than 255.
\r
46 The data type mapping obtains per-column meta information from the
\r
47 "PRAGMA table_info(...)" SQLite statement. If SELECTs are used which
\r
48 contain columns for which the table qualifier cannot be determined,
\r
49 no meta information for data type mapping is available and therefore
\r
50 the database source data type will be SQL_VARCHAR or SQL_LONGVARCHAR
\r
51 which usually maps to SQL_C_CHAR.
\r
53 Restrictions of data type mapping:
\r
55 - Integer and floating point columns in the database are reported
\r
56 as NULLs when no digit seen in the column, otherwise all digits
\r
57 up to end of string or non-digit are interpreted as the value,
\r
58 i.e. '10blurk' is ten, '0blurk' is zero, but 'blurk' is NULL.
\r
59 - Format for SQL_DATE is YYYY-MM-DD or YYYYMMDD
\r
60 - Format for SQL_TIME is hh:mm:ss or hhmmss
\r
61 - Format for SQL_TIMESTAMP is
\r
62 YYYYMMDDhhmmss[fraction]
\r
63 or YYYY-MM-DD hh:mm:ss[.fraction]
\r
64 or hh:mm:ss[.fraction] YYYY-MM-DD
\r
65 The fractional part is expressed as 1E-09 seconds
\r
66 - The driver puts the ODBC string representations for date/time,
\r
67 (eg for "{ts '2001-10-10 12:58:00'}" the substring within the
\r
68 single quotes) directly into the SQLite column
\r
71 Since November 17th, 2001, configure/libtool is used for the Un*x
\r
72 version which should automatically find the SQLite and unixODBC
\r
73 (or iODBC) header files and libraries. Do the usual
\r
75 $ ./configure && make
\r
81 in order to get /usr/local/lib/libsqliteodbc.so.
\r
82 Of course, you should have installed the unixODBC (or iODBC)
\r
83 development RPMs since the ODBC header files are required for
\r
84 the build of the SQLite ODBC driver.
\r
86 Since May 15th, 2003, (version 0.51), there are two variants
\r
87 of the SQLite 2.x driver for Win32 platforms: the first (sqliteodbc.dll)
\r
88 linked against ISO8859-1 SQLite library exporting ODBC/SQL ANSI
\r
89 functions, and the second (sqliteodbcu.dll) linked against UTF-8
\r
90 SQLite library exporting ODBC/SQL UNICODE functions.
\r
92 The UNICODE version is experimental and allows to turn off
\r
93 wide character SQL data types by its configuration dialog
\r
94 (checkmark labelled "No WCHAR"). It is known to work on Win32.
\r
95 It may work on UN*X too using newer version of unixODBC.
\r
97 To setup a SQLite data source using unixODBC (www.unixodbc.org):
\r
99 1. Add the driver to /etc/odbcinst.ini:
\r
102 Description=SQLite ODBC Driver
\r
103 Driver=/usr/local/lib/libsqliteodbc.so
\r
104 Setup=/usr/local/lib/libsqliteodbc.so
\r
107 2. Add a DSN to your private ~/.odbc.ini:
\r
110 Description=My SQLite test database
\r
112 Database=/home/johndoe/databases/mytest.db
\r
113 # optional lock timeout in milliseconds
\r
116 For iODBC (www.iodbc.org, only versions 3.0.[56] tested) do the
\r
119 1. Add the driver to /etc/odbcinst.ini:
\r
127 Driver=/usr/local/lib/libsqliteodbc.so
\r
129 2. Add a DSN to your private ~/.odbc.ini:
\r
131 [ODBC Data Sources]
\r
137 Driver=/usr/local/lib/libsqliteodbc.so
\r
138 Description=My SQLite test database
\r
139 Database=/home/johndoe/databases/mytest.db
\r
140 # optional lock timeout in milliseconds
\r
144 Python sample usage with eGenix mx-Extension
\r
145 (see http://www.lemburg.com/files/python/mxODBC.html)
\r
148 >>> import mx.ODBC.unixODBC
\r
149 >>> dbc=mx.ODBC.unixODBC.connect("mysqlitedb")
\r
150 >>> cur=dbc.cursor()
\r
151 >>> cur.execute("create table foo (id int, name string)")
\r
153 >>> cur.execute("insert into foo values(1, 'Me')")
\r
155 >>> cur.execute("insert into foo values(2, 'You')")
\r
158 >>> cur.execute("select * from foo")
\r
159 >>> print cur.fetchall()
\r
160 [(1, 'Me'), (2, 'You')]
\r
161 >>> print cur.fetchall()
\r
163 >>> cur.execute("drop table foo")
\r
168 Build instructions for MS Visual C++ 6.0:
\r
170 ... for SQLite 2.x.x
\r
172 1. Extract the source tarball sqliteodbc.tar.gz
\r
173 2. Extract the official SQLite 2.x.x sources in the sqliteodbc
\r
174 directory which resulted from step 1. Optionally, apply the
\r
175 sqlite-locale-patch-28* which matches your SQLite version
\r
176 3. Setup your MSVC++ environment, ie PATH/INCLUDE/LIB, then
\r
177 open a command window, cd to the sqliteodbc directory and enter:
\r
179 nmake -f sqliteodbc.mak
\r
181 This compiles the SQLite sources first, creates a link library
\r
182 of the necessary object files, then compiles and links the ODBC
\r
183 driver and the (un)install program.
\r
184 4. If you'd like to create the UNICODE version of the driver, enter:
\r
186 nmake -f sqliteodbc.mak clean
\r
187 nmake -f sqliteodbc.mak ENCODING=UTF8
\r
189 ... for SQLite 3.x.x
\r
191 1. Extract the source tarball sqliteodbc.tar.gz
\r
192 2. Extract the amalgamation SQLite 3.x.x. sources in the sqliteodbc
\r
193 directory which resulted from step 1.
\r
194 3. Setup your MSVC++ environment, ie PATH/INCLUDE/LIB, then
\r
195 open a command window, cd to the sqliteodbc directory and enter:
\r
197 nmake -f sqlite3odbc.mak
\r
199 This compiles the amalgamation SQLite3 source and the ODBC driver
\r
200 first, then and links the ODBC driver and the (un)install program.
\r
203 Names of Win32 Driver DLLs:
\r
205 sqliteodbc.dll Driver with ISO8859-1 SQLite2 engine
\r
206 sqliteodbcu.dll Driver with UTF-8/UNICODE SQLite2 engine
\r
207 sqlite3odbc.dll Driver with SQLite3 engine
\r
210 Build instructions for MingW cross compiler for Win32 targets:
\r
212 A script named mingw-cross-build.sh is provided which contains
\r
213 all necessary information. It downloads the required SQLite
\r
214 source tarballs and builds SQLite and the ODBC drivers. The
\r
215 final step is creating an NSIS installer.
\r
218 Build instructions for MingW cross compiler for Win64 targets:
\r
220 A script named mingw64-cross-build.sh is provided which contains
\r
221 all necessary information. It downloads the required SQLite
\r
222 source tarballs and builds SQLite 3 and the ODBC driver. The
\r
223 final step is creating an NSIS installer.
\r
226 Win32 install/remove/shell by RUNDLL32
\r
228 Each driver DLL provides entry points for ODBC driver installation
\r
229 and removal which can be invoked from RUNDLL32.EXE, eg
\r
231 ### install sqliteodbc.dll
\r
232 C:\> rundll32 [path]sqliteodbc.dll,install [quiet]
\r
234 ### remove sqlite3odbc.dll
\r
235 C:\> rundll32 [path]sqlite3odbc.dll,uninstall [quiet]
\r
237 If [path] is not provided newer Windows OSes tend to favor the
\r
238 sqlite*odbc*dll in system directories over the current directory,
\r
239 thus better provide an absolute path to the DLL of interest.
\r
240 If the word "quiet" appears anywhere after the DLL/function
\r
241 name, no info message boxes pop up (but errors are shown).
\r
243 An (interactive or batch) SQLite shell can be invoked, too, eg
\r
245 ### run SQLite shell on database C:\bla\my.db
\r
246 C:\> rundll32 [path]sqliteodbc.dll,shell C:\bla\my.db ...
\r
248 ### batch run with given SQL
\r
249 C:\> rundll32 [path]sqliteodbc.dll,shell -batch C:\bla\my.db
\r
250 "select * from table" <NUL: 2>NUL: >out.txt
\r
255 On Win64 (64 bit versions of Vista, Windows 7) both 32 bit and 64 bit
\r
256 drivers can be installed in parallel. The 32 bit drivers are required
\r
257 when using 32 bit applications. In order to manage 32 bit data
\r
258 sources, the 32 bit ODBC admin tool C:\Windows\SysWOW64\odbcad32.exe
\r
262 DSN-less connection to the driver
\r
264 Using the SQLDriverConnect() API it should be possible to connect to
\r
265 a SQLite database with these strings (Win32 and UN*X)
\r
267 DSN=SQLite Datasource;Database=full-path-to-db;...
\r
268 DSN=SQLite3 Datasource;Database=full-path-to-db;...
\r
274 Driver=SQLite ODBC Driver;Database=full-path-to-db;...
\r
275 Driver=SQLite3 ODBC Driver;Database=full-path-to-db;...
\r
279 Driver=SQLITE;Database=full-path-to-db;...
\r
280 Driver=SQLITE3;Database=full-path-to-db;...
\r
283 Build Instructions for Alpha/Tru64 (OSF1 V5.1) and HP/UX (B.11.23 U ia64)
\r
285 Nikola Radovanovic had success with these commands to build
\r
286 all required components:
\r
289 ./configure --prefix=$HOME/development --disable-tcl \
\r
290 CC='cc -pthread' CFLAGS='-DSQLITE_ENABLE_COLUMN_METADATA=1'
\r
291 gmake && gmake install
\r
294 ./configure --prefix=${HOME}/development --disable-gui \
\r
295 --without-x --enable-iconv=no
\r
296 gmake && gmake install
\r
298 sqliteodbc (>0.79):
\r
299 ./configure --with-sqlite3=${HOME}/development \
\r
300 --with-odbc=${HOME}/development --prefix=${HOME}/development \
\r
301 --enable-winterface=no
\r
302 OSF1: gmake && gmake install
\r
303 HP/UX: gmake CFLAGS="+DD64" && gmake install
\r
306 Build Instructions for RPM based systems
\r
308 rpmbuild -tb sqliteodbc-*.tar.gz
\r
311 Build Instructions for Debian based systems
\r
313 tar xzf sqliteodbc-*.tar.gz
\r
315 ./configure && make deb
\r
318 Special build to use System.Data.SQLite on Win32/Win64
\r
320 A variant of the SQLite3 ODBC driver can be build which uses
\r
321 internal dynamic linking to System.Data.SQLite.dll or sqlite3.dll.
\r
322 This feature is turned on when running the mingw*-cross-build.sh
\r
323 scripts with SQLITE_DLLS=2.
\r
329 - improve documentation
\r
334 mailto:chw@ch-werner.de
\r