OCamlODBC home page
Configuring OCamlODBCHere are some information about using OCamlODBC with some supported DBMS.
MySQL MySQLWhat you need :
Check http://www.mysql.com for downloads.
The easiest way is to get the iODBC library, compile it, install it. Then get the MyODBC library, compile it using the iODBC library, install it. Then adapt the MYSQL_ variables in the master.Makefile of OCamlODBC to your intallation paths and compile. Before executing a program accessing your favorite MySQL database through the iODBC library, you must have a ~/.odbc.ini file. Here is an example of this file (another example is included in the iODBC library) : [mydatabase] Trace = Off TraceFile = stderr Driver = /usr/local/lib/libmyodbc.so DSN = mydatabase SERVER = localhost USER = guesdon PASSWORD = PORT = 3306 #SOCKET = /tmp/mysql.sockThe difference between the mydatabase enclosed in [] and DSN = mydatabase is that when you connect through iODBC you'll refer to the name enclosed in [], and the DSN = mydatabase indicates to the iODBC driver that the corresponding database is mydatabase. The two names are usually the same, and you will have one section per database. PostgreSQLWhat you need :
Check http://www.postgresql.org for downloads. The Postgresql ODBC driver is based on the iODBC library. The postgresql-devel-... and postresql-odbc-... rpms are enough, since postgresql-devel-... comes with the header (.h) files iodbc.h, isql.h and isqlext.h, and opstgresql-odbc-... includes the needed libraries. Before compiling OCamlODBC, edit the file master.Makefile to set POSTGRES_ variables according to your installation. Before executing a program accessing your favorite Postgresql database through the Postgresql driver, you must have a ~/.odbc.ini file. Here is an example of this file : [ODBC Data Sources] mydatabase = Read/Write Database [mydatabase] Driver = /usr/lib/libpsqlodbc.so ReadOnly = 0 Database = mydatabase Servername = localhost UserName = guesdon Password= Port = 5432 [ODBC] InstallDir = /usr/lib/pgsqlThe difference between the mydatabase enclosed in [] and DSN = mydatabase is that when you connect through iODBC you'll refer to the name enclosed in [], and the DSN = mydatabase indicates to the iODBC driver that the corresponding database is mydatabase. The two names are usually the same, and you will have one section per database. The documentation of Posgresql about this file is very complete. At last, in order to be able to connect to the postmaster server, this one must be launched with -i option. unixODBCWhat you need :
Check http://www.unixODBC.com for downloads and compilation and installation instructions. There are good tutorials and explanations on this site. unixODBC is a kind of common interface for other ODBC drivers. It comes with graphical configuration tools which will create the correct ~/.odbc.ini file. The advantage is that you don't have to compile your application for each DBMS you want to access to, since the unixODBC driver will use the correct ODBC driver for the DBMS you want to connect to. Compile and install the unixODBC according to the given instructions. Then edit the file master.Makefile of OCamlODBC to set unixODBC_ variables according to your installation. AccessA script INSTALL_WIN32 and a ocamlodbc.DEF file area available to use OCamlODBC with Access, thanks to John Small and Clément Capel. Need some proof ? See the screenshot (Thanks to Clément Capel). DB2Yet to come... |