Ask Your Question
0

Problems with Active Connection [closed]

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

Quarto Die gravatar image

updated 2020-08-10 00:38:52 +0100

Alex Kemp 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 reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-21 01:34:12.320746

2 Answers

Sort by » oldest newest most voted
1

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

Ratslinger gravatar image

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

Try this:

    if IsNull(Thisdatabasedocument.CurrentController.ActiveConnection) then
       Thisdatabasedocument.CurrentController.connect
    endif

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

Comments

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 +0100 )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 +0100 )edit
0

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

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

Question Tools

1 follower

Stats

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

Seen: 371 times

Last updated: May 13 '17