RHEL5下unixODBC 与 sqliteodbc 连接配置

OS: RHEL5

gcc version: 4.3.2

 

安装:

unixODBC                           http://www.unixodbc.org/

SQLite ODBC Driver              http://www.ch-werner.de/sqliteodbc/

 

编译:

unixODBC

# tar -zxvf unixODBC-2.2.14.tar.gz # cd unixODBC-2.2.14 # ./configure --enable-gui=no --without-x --enable-gui=no --without-x 指定不支持GUI # make && make install

 

sqliteodbc

需要确认sqlite库及头文件已安装

# tar -zxvf sqliteodbc-0.83.tar.tar # cd sqliteodbc-0.83 # ./configure # make && make install

 

全部安装到默认位置/usr/local/,可以通过--prefix=xxx 指定安装目录

 

配置:

#列出配置文件位置

# odbcinst -j unixODBC 2.2.14 DRIVERS............: /usr/local/etc/odbcinst.ini SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources USER DATA SOURCES..: /root/.odbc.ini SQLULEN Size.......: 4 SQLLEN Size........: 4 SQLSETPOSIROW Size.: 2

 

 

编辑odbcinst.ini, 添加sqliteodbc drvier

vi /usr/local/etc/odbcinst.ini [SQLite] Description=SQLite ODBC Driver # sqliteodbc library库位置 Driver=/usr/local/lib/libsqlite3odbc-0.83.so Setup=/usr/local/lib/libsqlite3odbc-0.83.so Threading=2

 

添加一个用户DSN

vi ~/.odbc.ini [mysqlitedb] Description=My SQLite test database Driver=SQLite # sqlite 数据库位置 Database=/monitoring/conf/monitoring.db # optional lock timeout in milliseconds Timeout=2000

# 列出当前的所有DSN

# odbcinst -q -s [mysqlitedb]

识别成功.

 

连接数据库

# isql mysqlitedb +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL>

完成sqlite的ODBC配置. :)

 

你可能感兴趣的:(sql,数据库,sqlite,gcc,database,library)