How to: Linux Mint15 + unixODBC + MYSQL
Posted: Sat Aug 17, 2013 3:07 pm
6 Hours later, i managed to finally getting it working!
Open a console and follow these steps:
install unixodbc (if not already)
install MySQL odbc driver (if not already)
Check paths:
Edit /etc/odbcinst.ini as root:
Edit /etc/odbc.ini as root:
Testing:
Testing in Purebasic:
Open a console and follow these steps:
install unixodbc (if not already)
Code: Select all
sudo apt-get install unixodbcCode: Select all
sudo apt-get install libmyodbc
(on my x86 machine it installed to /usr/lib/i386-linux-gnu/odbc/libmyodbc.so)Code: Select all
odbcinst -j
output:
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/rui-carvalho/.odbc.ini
SQLULEN Size.......: 4
SQLLEN Size........: 4
SQLSETPOSIROW Size.: 2
Code: Select all
[MySQL]
Description = MySQL driver
Driver = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so
Code: Select all
[testing]
Description = Mysql database
Driver = MySQL
Server = 127.0.0.1
Database = how2installdb
UID = root
PWD = how2install
Code: Select all
isql testing
should output:
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
Code: Select all
UseODBCDatabase()
If OpenDatabase(0, "testing", "", "")
Debug "Connected to MySQL"
Else
Debug "Connection failed: "+DatabaseError()
EndIf