Page 1 of 1

Can't connect via ODBC

Posted: 29.11.2020, 17:30
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.

Re: Can't connect via ODBC

Posted: 26.03.2024, 19:21
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...

Re: Can't connect via ODBC

Posted: 27.03.2024, 11:34
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