Page 1 of 1

UnixODBC and Debian 11 Bullseye is not working?

Posted: Wed Oct 13, 2021 7:26 am
by RauhutMR
Hi,
i`am using PB 5.73 amd64 on Debian Bullseye and have a Problem with ODBC MySQL and Oracle Databases.
I think my unixodbc is installed correctly because it is posible to connect to the Databases via isql.
Exampl: isql DB USER PASSWORD let me execute SQL commands.
But if i try:

Code: Select all

UseODBCDatabase()
#db_mysql1=1
Debug OpenDatabase(#db_mysql1,"DB","USER","PASSWORD",#PB_Database_ODBC)
Debug DatabaseError()
sql.s="show databases;"
DatabaseQuery(#db_mysql1,sql)
Debug DatabaseError()
While NextDatabaseRow(#db_mysql1)
  Debug GetDatabaseString(#db_mysql1,0)  
Wend
i get 0 from opendatabase and a "Database is not initialized" Error.

It is posible to connect to PostgreSQL with UsePostgreSQLDatabase().

I think this is some sort of a Debian Bullseye problem..
unixodbc is installed in version 2.3.6-0.1+b1

Any Ideas?

Re: UnixODBC and Debian 11 Bullseye is not workin?

Posted: Wed Oct 13, 2021 11:01 am
by Marc56us
I think everyone knows, but just in case, a tip for beginners
:!: (Not the solution here), but in all case, avoid put function after Debug
(because all the line will be ignored when running with Debug Off or in compiled mode)

Code: Select all

; No
Debug OpenDatabase(...

; Yes
ReturnValue = OpenDatabase(...
Debug ReturnValue
:wink:

Re: UnixODBC and Debian 11 Bullseye is not working?

Posted: Thu Oct 14, 2021 2:36 pm
by RauhutMR
After i switched to this:

Code: Select all

rc_use=UseMySQLDatabase()
Debug rc_use
#db_mysql1=1

rc_open=OpenDatabase(#db_mysql1, "host=127.0.0.1 port=3306 dbname=DB", "USER", "PASSWORD")
Debug rc_open
rc_dbe.s=DatabaseError()
Debug rc_dbe
sql.s="show databases;"
DatabaseQuery(#db_mysql1,sql)
rc_dbe=DatabaseError()
Debug rc_dbe
While NextDatabaseRow(#db_mysql1)
  Debug GetDatabaseString(#db_mysql1,0)  
Wend
it is working.
Oracle works over ODBC...