FreePascal Information Logo Friend of FreePascal Compiler Title
Articles with Feedback, FPC News Library, PDF Collection, Mail Lists, Books, Newsgroups, IRC Open online discussion areas Research and Tutorials Tools, Compilers and Utilities Blurbs about us, advertising, etc.
Welcome to the FoFPC Message Board, Database Programming , Using Unix ODBC

You may not copy or reproduce any of these message boards without written permission from both the author and 3F, LLC. All messages are (c) 2009 by 3F, LLC. All rights reserved, worldwide.

Previous Message(s) Previous Message(s) Help Reload this area
Using Unix ODBC
Login Credentials
Email Address: 
Password: 
To Sign-Up Answer BOTH columns of fields
Email Verify: 
Password Verify: 
First Name: 
Last Name: 


Posted: Mon, 15 Jun 2009 23:15:57 +0000
From: Ozz Nixon member since Jun 12 2009, has contibuted 79 messages.
Getting unixODBC for Linux(s)

deb/ubuntu: apt-get install unixODBC
rhel/fedora: yum install unixODBC

Configuration

/etc/odbcinst.ini

Is for the database libraries and configuring their parameters on a global level.

[PostgreSQL]
Description = PostgreSQL driver for Linux & Win32
Driver = /usr/local/lib/libodbcpsql.so
Setup = /usr/local/lib/libodbcpsqlS.so
FileUsage = 1
Threading = 2

/etc/odbc.ini

[PostgreSQL]
Description = Test to Postgres
Driver = PostgreSQL
Trace = Yes
TraceFile = sql.log
Database = nick
Servername = localhost
UserName =
Password =
Port = 5432
Protocol = 6.4
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =

Is for the actual alias used by your ODBC client. Now, if you cannot get root access to modify the odbcinst.ini file, you can replace the Driver = SectionName_in_odbcinst to the actual path, like so:

[PostgreSQL]
Description = Test to Postgres
Driver = /usr/local/lib/libodbcpsql.so
Trace = Yes
TraceFile = sql.log
Database = nick
Servername = localhost
UserName =
Password =
Port = 5432
Protocol = 6.4
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =

Sample for many databases

/etc/odbcinst.ini

[Mini SQL]
Description = MiniSQL
Driver = MiniSQL
Trace = No
TraceFile =
Host = localhost
Database =
ConfigFile =

[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc.so
Setup = /usr/lib/libodbcmyS.so
UsageCount = 2
Trace = Off
TraceFile = stderr

[MySQL ODBC 3.51 Driver]
Description = ODBC 3.51 for MySQL
DRIVER = /usr/lib/libmyodbc3.so
SETUP = /usr/lib/libmyodbc3S.so
UsageCount = 2
Trace = Off
TraceFile = stderr

[FreeTDS]
Description = Tabular Data Stream protocol for MS SQL and Sybase
Driver = /usr/local/freetds/lib/libtdsodbc.so

[DB2_V8]
Description = DB2 v8.1 driver for Linux
Driver = /opt/IBM/db2/V8.1/lib/libdb2.so
Fileusage = 3
Dontdlclose=1

[DB2_V9]
Description = DB2 v9.5 driver for Linux
Driver = /opt/ibm/db2/V9.5/lib32/libdb2.so
Fileusage = 3
Dontdlclose=1

[DB2_EXP]
Description = DB2 v9.5 Express-C driver for Linux
Driver = /opt/ibm/db2exc/V9.5/lib32/libdb2.so
Fileusage = 3
Dontdlclose=1

[SQLite]
Description = SQLite ODBC Driver
Driver = /usr/lib/odbc/libsqliteodbc.so
Setup = /usr/lib/odbc/libsqliteodbc.so
UsageCount = 1

[OracleExpressdrv]
Description = Oracle 10g express driver
Driver = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/libsqora.so.10.1
Oracle in Client10_1 APILevel - 1
ConnectionFunctions = YYY
CPTimeout = 60
DriverODBCVer = 03.51
FileUsage = 0
SQLLevel = 1

Windows:
Driver = C:\Program Files\Oracle\Client10_1\SQORA32.dll

[owb1odbc]
Description = Oracle 10g R2 ODBC driver.
Driver = /opt/app/oracle/product/10.2.0/db_1/lib/libsqora.so.10.1
Setup =
FileUsage =
CPTimeout =
CPReuse =
UsageCount = 1

[Firebird]
Description = InterBase/Firebird ODBC Driver
Driver = /usr/lib/libOdbcJdbc.so
Setup = /usr/lib/libOdbcJdbcS.so
Threading = 1
FileUsage = 1
CPTimeout =
CPReuse =

/etc/odbc.ini

[MYSQL_TEST]
Driver = MySQL
SERVER = 192.168.1.26
USER = root
PASSWORD =
PORT = 3306
DATABASE = test

[nntp Data Source]
Description = nntp Driver
Driver = nntp Driver
Trace = No
TraceFile =
Host = localhost
Database =
Port =

[FreeTDS_Sample]
Driver = FreeTDS
Description = Northwind sample database
Trace = No
Server = 192.168.1.25
Database = Northwind
UID = sa
Port = 4444
PWD =

[Sybase SQL Anywhere 5.0]
Driver=Sybase SQL Anywhere 5.0
Description=Sybase SQL Anywhere 5.0 ODBC Driver
Userid=dba
Password=sql
DatabaseFile=sademo.db

[firebird_help]
Description = Firebird
Driver = Firebird
Dbname = localhost:/var/lib/firebird/2.0/system/help.fdb
User = SYSDBA
Password = masterkey
Role =
CharacterSet =
ReadOnly = No
NoWait = No

[ora102]
Application Attributes = T
Attributes = W
BatchAutocommitMode = IfAllSuccessful
CloseCursor = T
DisableDPM = F
DisableMTS = T
Driver = owb1odbc
DSN = ora102
EXECSchemaOpt =
EXECSyntax = T
Failover = T
FailoverDelay = 10
FailoverRetryCount = 10
FetchBufferSize = 64000
ForceWCHAR = F
Lobs = T
Longs = T
MetadataIdDefault = F
QueryTimeout = T
ResultSets = T
ServerName = owb1
SQLGetData extensions = F
Translation DLL =
Translation Option = 0
UserID = std_rep

 Links and Products we find useful



ButtonGenerator.com
Valid XHTML 1.0 Transitional Internet Map
Programmer's Heaven
grat-i-fi-ca-tion - noun
the state of being gratified; great satisfaction.


I am very happy to see that FoFPC is alive, we need more developers working on this great language.
Matias Vara
toro.sourceforge.net
Locations of visitors to this page world map hits counter
Copyright 2009 by 3F, LLC. All rights reserved. Worldwide.
Your request was processed by server #2 in 0.013607 secs.

sponsor
This sponsor helps us with our documentation