Problems connecting via macro to external (MariaDB) DB in Base

I would very much appreciate some help so I can continue to make progress on my project.

I’m working in Ubuntu 13.04. I’ve created a DB using MariaDB and successfully connect to it and can access and create tables in it using LibreOffice BaseEXCEPT I can’t figure out how to modify a table using a macro.

When I search the web I keep coming up with the following code:

Dim Context Dim DB Dim Conn Dim Stmt
Dim Result Dim strSQL As String
Context=CreateUnoService(“com.sun.star.sdb.DatabaseContext”)
DB=Context.getByName(“MikesTest”)
Conn=DB.getConnection("","")

Stmt=Conn.createStatement()
strSQL=“INSERT INTO _
EMPLOYEES(FIRSTNAME,MIDDLENAME,LASTNAME,AGE,SSN) _
VALUES(‘Hubert’,’’,‘Farnsworth’,‘164’,‘511-11-1111’)”
Stmt.executeUpdate(strSQL)

Conn.close()

My problem is, I haven’t been able to get past
DB=Context.getByName(“MikesTest”)

I keep getting the error message:

BASIC runtime error. An exception
occurred Type:
com.sun.star.container.NoSuchElementException
Message: MikesTest.

“MikesTest” is the registered name of the DB in LO. That doesn’t work. Nor does a full path to the DB. Nor does just the DB name without the full path.

So what is the trick here? I’m sure it is obvious to the initiated.

Thanks for any help on the frustrating stalemate.

I think I found the problem. Although I thought the db was registered, it was not. I manually registered it and got past the error message which was stymying me.

I got it! Unregistered DB. Manually registered and got past the immediate problem.

Thanks for reporting your solution.

I’m having a similar pb. Frst Form opens fine by macro :

Sub Ouvre_Recherche_par_nom( oEvent as variant )
ThisDatabaseDocument.FormDocuments.getByName(“Recherche_par_nom”).open
End Sub

the secund gives ERROR : Type: com.sun.star.container.NoSuchElementException
Message: Nouveau_Contact.

I’m having a similar pb :

opening a first Form “F_Contact.” by macro work fine :
Sub Ouvre_Recherche_par_nom( oEvent as variant )
ThisDatabaseDocument.FormDocuments.getByName(“F_Contact”).open
End Sub

Opening a other form " New_Contact" with a new macro is not working :
Sub Ouvre_New_Contact( oEvent as variant )
ThisDatabaseDocument.FormDocuments.getByName(“New_Contact”).open
End Sub

ERROR Type: com.sun.star.container.NoSuchElementException Message: New_Contact !