Main Board > Programming
accessing mySQL-DB
Thomas Bock:
We encounter problems with a newer version of libmariadb.so.3
PxPlus 20.10 is installed on a Linux server.
The program below runs with version 3.1.13 on a Linux server. With version 3.2.7 the result is empty and msg(-1) returns "MYSQL:0:".
--- Code: ---begin
dbOpt$ = "SERVER=my_server;USER=my_account;PASSWORD=my_password;DATETIME_CONVERT=N"
dbName$ = "[MYSQL]my_database;;"
channel = hfn
open (channel, OPT = dbOpt$, tim = 10) dbName$
query$ = "SELECT * FROM `myTable` limit 1"
write record (channel)query$
gosub buildPVXIOList
repeat
read record(channel,err=*next)sqlResultItem$
if tcb(2) {
print msg(err)
print msg(-1)
break
}
print ++c,": ",sqlResultItem$
until 0
close( channel)
end
buildPVXIOList:
local sqlIOL$ = ken(channel, ind = 3)
local pvxIOL$ = "IOLIST "
local separator$ = $$
local items = pos(";" = sqlIOL$, 1, 0)
local counter = 0
local virtual = 0
repeat
fieldDefinition$ = arg(sqlIOL$, counter + 1, ";")
read data from fieldDefinition$, sep = "," to fieldName$, fieldType$
fieldName$ = tbl(nul(fieldName$), fieldName$, "_VIRTUAL" + str(++virtual))
pvxIOL$ += separator$ + fieldName$
if (mid(fieldType$, 1, 3) = "CHR") or (fieldType$ = "DATE") {
pvxIOL$ += "$"
}
separator$ = ","
until (++counter > items)
pvxIOL$ = sub(pvxIOL$, "-", "_")
dim sqlResultItem$ : cpl(pvxIOL$)
return
--- End code ---
What needs to be done in order to work with then newer version?
EVa:
I'm running CentOS8, my MariaDB library version is:
libmariadb.so.3-3.1.11-2.el8_3.x86_64
Your program codes works without an error in v20.10 (64-bit).
Thomas Bock:
That's what I'm saying.
But the issue comes with version 3.2.7.
EVa:
Can you tell me the Linux version that you are using (I assume it's the 64-bit version of both the OS and PxPlus) ?
Thomas Bock:
The customer uses openSUSE Leap 15.5
We use a Gentoo and can reproduce the issue
Navigation
[0] Message Index
[#] Next page
Go to full version