UnixODBC and Debian 11 Bullseye is not working?

Linux specific forum
RauhutMR
New User
New User
Posts: 2
Joined: Tue Oct 12, 2021 3:26 pm

UnixODBC and Debian 11 Bullseye is not working?

Post 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?
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: UnixODBC and Debian 11 Bullseye is not workin?

Post 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:
RauhutMR
New User
New User
Posts: 2
Joined: Tue Oct 12, 2021 3:26 pm

Re: UnixODBC and Debian 11 Bullseye is not working?

Post 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...
Post Reply