Make it Technical: Create DSN on *nix

install
# apt-get install unixodbc unixodbc-dev libmyodbc odbc-postgresql

goto the folder
# cd /etc/ODBCDataSources

Write the driver setting: mysql_odbc_template
[MySQL]
Description = MySQL driver
Driver = /usr/lib/odbc/libmyodbc.so
Setup = /usr/lib/odbc/libodbcmyS.so

Install data source driver
# odbcinst -i -d -f mysql_odbc_template

Uninstall data source driver
# odbcinst -u -d -n MySQL

List installed driver
# odbcinst -q -d

Write the driver setting: mysql_dsn
[mysql_ejabberd]
Driver = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
SERVER = localhost
PORT = 3306
DATABASE = ejabberd
OPTION = 3
USER = ejabberd
PASSWORD = xxxxxxxx

install dsn
# odbcinst -i -s -l -f mysql_dsn

List installed dsn’s
# odbcinst -q -s

Reference:

UnixODBC example setup and configuration on Ubuntu Lucid with Mysql and PostgreSQL using the command line only

發表留言