Connect to Oracle via MBS Xojo SQL Plugin
Now you can use SQLDatabaseMBS or SQLConnectionMBS classes to connect. You may need to specify the database connection string. As we use Oracle, it starts with "Oracle:", so SQLDatabaseMBS knows which driver to use. Next you specify hostname with optional port and service name in format <hostname>[:<port>][/<service_name>]. Please also set option with kOptionLibraryOracle constant to the path pointing to the DLL file. You can either use SetFileOption with folder item, Option() with file path or just let it away and the plugin will look for oci.dll itself. Here some example code:
Dim db As New SQLDatabaseMBS
// where is the oci.dll library?
Dim fa As FolderItem = GetFolderItem("C:\Oracle\instantclient_19_3\oci.dll", FolderItem.PathTypeNative)
DB.SetFileOption(SQLConnectionMBS.kOptionLibraryOracle, fa)
DB.DatabaseName = "Oracle:" + "localhost:1521/XE"
DB.UserName = "zEPI"
DB.Password = "root"
if DB.Connect then
MsgBox "We are connected. Server Version: " + db.ServerVersionString
else
MsgBox db.ErrorMessage
end if
Please do not hesitate to contact us with your questions.