Ask Your Question

Problems with Active Connection

asked 2017-05-12 23:47:39 +0200

Quarto Die gravatar image

Using a split database, I am trying to run a text file containing an sql command using a push button in a form.

Here the macro: sub dosql if IsNull(ThisComponent.CurrentController.ActiveConnection) then ThisComponent.CurrentController.connect endif txtfile="/home/xxxx/Desktop/sqls.txt" f1 = FreeFile() Open txtfile for Input as #f1

Do while NOT EOF(f1) Line Input #f1, s rem MsgBox(s) oStatement = ThisComponent.CurrentController.ActiveConnection.createStatement() oStatement.execute(s) Loop end sub

When I run this macro using the Tools, Macros, Run Macro command, it works.

However, when I assign this macro to a push button in a form. I get the following:image description

When I check to see if there is an active connection in the database by right clicking on the main screen on the Database connection I get this: Error code: 1000

The driver class 'org.hsqldb.jdbcDriver' could not be loaded.

Maybe that is part of the problem. Please excuse my ignorance.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-05-13 00:07:42 +0200

Ratslinger gravatar image

updated 2017-05-13 00:16:56 +0200

Try this:

    if IsNull(Thisdatabasedocument.CurrentController.ActiveConnection) then

Edit: Sorry but you will need to change you oStatement = also:

    oStatement = Thisdatabasedocument.CurrentController.ActiveConnection.createStatement()

s If this answers your question please click on the ✔ (upper left area of answer).

edit flag offensive delete link more


Thank you, it worked. But nothing happened when I clicked the check mark. Hopefully it will change something.

Quarto Die gravatar imageQuarto Die ( 2017-05-13 01:49:53 +0200 )edit

@Quarto Die You are quite welcome. The check mark worked. It responds very slowly so patience is required.

Ratslinger gravatar imageRatslinger ( 2017-05-13 02:02:24 +0200 )edit

answered 2017-05-13 03:49:21 +0200

EasyTrieve gravatar image

You're missing a period:

Is: The driver class 'org.hsqldb.jdbcDriver' could not be loaded. Should be: The driver class 'org.hsqldb.jdbc.Driver' could not be loaded.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-05-12 23:47:39 +0200

Seen: 333 times

Last updated: May 13 '17