Calc error Message:./connectivity/source/mysql/mysql_drivers.cxx:128

Hi All.
I have a Calc file with macros using Mysql connector that worked perfectly previously but I have upgraded to Libreoffice 7.3.7.2 from Libreoffice 6

the error message is as follows
BASIC runtime error.
An exception occurred
Type:com.sun.star.lang.DisposedException
Message:./connectivity/source/drivers/mysql/mysql_driver.cxx:128

I have looked around the search engines and come up with very little in the way of results

Macro.

sub charges ''' bring in a list of current charges

Sheet8 = ThisComponent.Sheets.getbyname("admin")
'''	make contact with MYSQL server '''

rem Run an SQL command on a table in LibreOffice Base
Context = CreateUnoService("com.sun.star.sdb.DatabaseContext")

rem URL of database (it is also possible to use a registered DB name)
DATABASE_NAME = "file:///home/user/myfile.odb"
Db = Context.getByName(DATABASE_NAME)


rem connect to the database
Conn = Db.getConnection("user","passwd") 

rem create statement object
Stmt = Conn.createStatement()

'''	get hour rate    
strSQL1 = "SELECT Hour_rate  from Charge_rates where record = 1 "   
oResult =   Stmt.executequery(strSQL1)
oResult.next
outputvalue = oResult.getstring(1)
Sheet8.getCellRangeByName("M6").setvalue outputvalue

‘’’ get fuel charge
strSQL2 = "SELECT Fuel_rate from Charge_rates where record = 1 "
oResult = Stmt.executequery(strSQL2)
oResult.next
outputvalue = oResult.getstring(1)
Sheet8.getCellRangeByName(“M5”).setvalue outputvalue

end sub

the number at the end of the message (128) is that an error code?

Many thanks. Neil

Do you really have the odb-file in this place? So questioning, if your file/database is really opened. Does your user have the right to access this file?
And, if your LibreOffice is in a Snap/Container, can it even access this path? (You upgraded only LibreOffice, or your complete OS, mabe some Ubuntu?)

Hi.
the file file:///home/user/mydb.odb does exist and when opened it brings in a list of calc files from the DB which I can open from a button on the form.
It seems to open as normal but some of the forms bring up different errors

The calc files open as normal but create errors as above when running the macros. even if i open them normally.

I have a fresh install of linux mint 21.1 and was on Linux mint 19 and Libreoffice 6 (I think)
Neil

The number 128 after mysql_drivers.cxx refers to the line in that c++ file, which is one of the source code files for the mysql driver support within LO. The implication, without knowing that line of code, is that some code path, when called, encounters a problem within that file.

https://git.libreoffice.org/core/+/refs/tags/libreoffice-7.3.7.2/connectivity/source/drivers/mysqlc/mysqlc_driver.cxx#128

Note that OP has likely made typos in their error message, not copy-pasted it; there’s no mysql/mysql_driver.cxx, but mysqlc/mysqlc_driver.cxx.

  1. Check if LibreOffice 7.4 also gives you the error.
  2. Provide a set of files to test this: the spreadsheet with the macro, and the database with a sample data (IIUC, it only needs one table with one record to repro?).

Hi and thanks for all your help.
The link above i did find that when my initial search and to be honest i didn’t have a clue what to do with it (and still dont)
I am now using Libreoffice 7.4.4.2 and I still get the errors as before.
I also have another problem with the base forms aswell which I think my be linked to this, I get errors if any of my forms have sub forms in them but a strait forward fetch data form runs fine.
It seems as that when the macro run it goes like this
-connect to database-
do something
-do something else- ERROR HERE
I modified a different file
so that the -connect to database- was between each of the -do somethings- it would work fine
Its like its losing the connection after each -do something-
V24.ots (33.2 KB)

If you are using a direct mysql connector, could you please provide the version and package you use? The kind of disposed error you have reported sometimes occurs with particular distrib versions of the connector library, which would not be a LibreOffice bug.
The lack of execution of the second loop sounds very similar to tdf#112423 or tdf#103685

I haven’t installed any additional connector software (I don’t think i have?), which to be honest I had not even given thought to it.
Normally on a fresh install it wont even connect so that makes me look for the drivers needed, this time it has connected but giving me my sub form errors
The calc files I have managed to make them work by inserting the -connect to DB- between each of the -do something- so its a work around and I still have some more files to alter but at least they work
the bug reports above are 5 and six years old it would surprise me if they around, that said they do sound similar to my problem.
on the base file Edit/database/Connection type/ it says MYSQL/MariaDB Connector If I try a different connector type it wipes all my forms out and starts a fresh DB

from the software manager I installed (Linux Mint 21.1 Cinnamon)
libreoffice-sdbc-mysql 1:7.3.7-0ubuntu0.22.04.1
libreoffice-sdbc-hsqldb 1:7.3.7-0ubuntu0.22.04.1
neither of these made any differance to either my original cal form or my DB file

As I said I think my DB file and my calc file problems are related in some way for all they give different errors
I have a work around for my calc files, would I be better asking a new topic/question on my base DB errors?