Du kannst JDBC-Treiber konfigurieren unter Extras>Optionen>Erweitert, [Klassenpfad…], da wo auch die Java-Version festgelegt werden kann.
Bei HSQL hat das Eintragen einer neueren HSQLDB-Version die Auswirkung, dass man danach keine eingebetteten HSQLDB mehr benutzen kann. Ich weiß nicht, ob das für eingebettete Firebird auch so gilt.
Es gibt aber die Möglichkeit, den zu verwendenden JDBC Treiber individuell für das Datenbankdokument festzulegen. Dafür gibt es keine GUI, aber das folgende Basic-Snippet erledigt diesen Job. Kopiere das in den Basic editor und verändere die Konstanten. Das Makro versucht, aus Deinen Angaben eine gültige JDBC-URL zu verketten. Darüber hinaus trägt es den Pfad zum Treiber ein, die Java-Klasse, den Benutzernamen und ob beim Öffnen ein Passwort abgefragt werden muss oder ob das Passwort leer ist. Kommentiere die Aktionen aus, die Du nicht brauchst.
Sub Connect_JDBC_Backend()
REM This mini version of my FreeHSQLDB macro should be able to reconnect
REM a database document with any type of JDBC connection (HSQL, MySQL or other)
REM if you set up the right constants for a valid URL, a driver path and class name
REM oDoc = ThisDatabaseDocument ' this code is embedded in the odb
oDoc = ThisComponent ' this code is not embedded in the odb
REM-------- Database Location (URL) --------------------
REM protocol prefix refering to a set of files
REM Const cURL_Prefix = "jdbc:hsqldb:file:"
REM protocol prefix refering to a database server
Const cURL_Prefix = "jdbc:hsqldb:hsql:"
REM file path or server name with trailing slash
REM in case of cURL_Prefix = "jdbc:hsqldb:file:"
REM Const cURL_Path = "C:\path\hsqldb\DUMMY"
REM HSQL on Windows accepts strange URLs with slashes or with backslashes such as
REM Const cURL_Path = "C:\Users\UserName\HSQLDB\"
REM local files on a Linux sytem:
REM Const cURL_Path = "/var/hsql/database/"
REM in case of cURL_Prefix = "jdbc:hsqldb:hsql:" we specify a server name or IP address
REM Const cURL_Path = "//ServerName/"
Const cURL_Path = "//192.168/178.1/"
REM Either the database name is set up by a remote server if cURL_Prefix looks like "jdbc:hsqldb:hsql:
REM if cURL_Prefix looks like "jdbc:hsqldb:file:" the nae refers to a set of files starting with the same prefix
REM DatabaseName.properties DatabaseName.script DatabaseName.data etc.
Const cURL_DBName = "DUMMY" 'file name prefix or database name defined on server side
REM options that turned out to be useful with HSQL (see HSQL documentation)
Const cURL_Options = ";default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false"
REM JDBC connections other than hsql may support other options
REM or none at all:
REM cURL_Options = ""
REM--------- Database Driver -------------------
REM use system notation for the local HSQL driver
Const cJarPath = "C:\path\hsqldb-2.4.1.jar"
REM the "ability" used by the JDBC driver when used with a client:
Const cClass = "org.hsqldb.jdbcDriver"
REM user name logging in at the JDBC database
Const cUser = "SA"
REM does the JDBC connection require any password?
Const cPwdRequired = False
REM if you insist in storing the password in the Base document (which is a security issue)
Const cPWD = ""
sURL = cURL_Prefix & cURL_Path & cURL_DBName & cURL_Options
sMsg = "URL: "& sURL & Chr(10) & _
"JAR: "& cJarPath & Chr(10) & _
"CLASS: "& cClass & Chr(10) & _
"USER: "& cUser & Chr(10) & _
"PWD: "& cPWD
x = Msgbox(sMsg, 33)
if x = 2 then exit sub
on error resume next
oDoc.CurrentController.ActiveConnection.close()
on error goto 0
oDataSource = oDoc.DataSource
oDataSource.URL = sURL
With oDataSource.Settings
.JavaDriverClass = cClass
.JavaDriverClassPath = ConvertToURL(cJarPath)
End With
oDataSource.User = cUser
oDataSource.IsPasswordRequired = cPWDReq
oDataSource.Password = cPwd
End Sub
Wahrscheinlich brauchst Du nur:
With oDataSource.Settings
.JavaDriverClass = cClass
.JavaDriverClassPath = ConvertToURL(cJarPath)
End With