Can't connect via ODBC

Forum related to ODBC access driver introduced since Zeos-7.3
Post Reply
Vodnik
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 13.11.2020, 11:17

Can't connect via ODBC

Post by Vodnik »

So I have IBM Informix 32-bit driver set up in Windows.
I'm trying to connect to it with TZConnection (Zeos 8.0) in Lazarus 2.0.10. 32-bit.
I set up Database=ODBC_Informix (that is the DSN) and Protocol=odbc_a, but got error:
SQL Error: IM002[0]:[Microsoft][ODBC Driver Manager]. Data source name not found and no default driver specified.
Connection to this DSN with TConnection is OK.
Similar problem often happens when driver looks for 64-bit DSN instead.
What I'm doing wrong?
PS I have tried to set up ZConnection to other DSNs available in my system, both 32 and 64-bit: MS Access, SQLite, dBase, etc. but always get the same error.
kikep
Fresh Boarder
Fresh Boarder
Posts: 19
Joined: 06.03.2024, 17:47

Re: Can't connect via ODBC

Post by kikep »

I have similar problem when connection string has DSN=MAS9032 witch is the DSN on datasource just eliaminate that and only put the connection string with DSN=
and works for me but the problem is i cannot get schematables if you don't have stables schema you don't can't open any table ort query...
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1918
Joined: 17.01.2011, 14:17

Re: Can't connect via ODBC

Post by marsupilami »

Hello Vodnik,

the ODBC drivers in Zeos only workes with ODBC connectrion strings until now (see https://www.connectionstrings.com).
To connect to a DSN you would have to siupply a connection string like 'DSN=ODBC_Informix'.

The change from today checks if there is a = in the database name. If there is none, it prepends the database name in TZConnection with DSN=

So TZConnection.Database := 'SOME_DSN' internally becomes 'DSN=SOME_DSN'.

This should allow to connect in situations where only a DSN name is provided to Zeos.

With best regards,

Jan
Post Reply