Platforms to show: All Mac Windows Linux Cross-Platform

Back to JavaDatabaseMBS class.

JavaDatabaseMBS.connect(url as string) as JavaConnectionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java Database MBS Java Plugin 12.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Connects directly to the database calling the Drivers's connect method.

While getConnection calls DriverManager, this calls directly the driver.

Attempts to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn.
The driver should throw an SQLException if it is the right driver to connect to the given URL but has trouble connecting to the database.

The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. Normally at least "user" and "password" properties should be included in the Properties object. (the plugin passes empty Properties object)

url - the URL of the database to which to connect

Returns a Connection object that represents a connection to the URL
Throws SQLException - if a database access error occurs

JavaDatabaseMBS.Constructor(vm as JavaVMMBS, driverclass as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java Database MBS Java Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Creates a new java database object.
Example
dim vm as JavaVMMBS // your VM
dim db as JavaDatabaseMBS

db=new JavaDatabaseMBS(vm,"com.mysql.jdbc.Driver")

The driverclass is the name of the main class of the jdbc driver.

JavaDatabaseMBS.getConnection(url as string) as JavaConnectionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java Database MBS Java Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Attempts to establish a connection to the given database URL.
Example
dim d as JavaDatabaseMBS
dim c as JavaConnectionMBS

// get database

// connect to Oracle database using service name:
c=d.getConnection("jdbc:oracle:thin:@//192.168.10.20:1521/adbprod","user","pw")

// connect with SID:
c=d.getConnection("jdbc:oracle:thin:@192.168.10.20:1521:adbprod","user","pw")

The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Parameters:
url - a database url of the form jdbc:subprotocol:subname
Returns:
a connection to the URL

See also:

JavaDatabaseMBS.getConnection(url as string, username as string, password as string) as JavaConnectionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java Database MBS Java Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Attempts to establish a connection to the given database URL.
Example
dim d as JavaDatabaseMBS
dim c as JavaConnectionMBS

// get database

// connect to Oracle database using service name:
c=d.getConnection("jdbc:oracle:thin:@//192.168.10.20:1521/adbprod","user","pw")

// connect with SID:
c=d.getConnection("jdbc:oracle:thin:@192.168.10.20:1521:adbprod","user","pw")

The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.

Parameters:
url - a database url of the form jdbc:subprotocol:subname
user - the database user on whose behalf the connection is being made
password - the user's password

Returns:
a connection to the URL

See also:

JavaDatabaseMBS.IsDriverLoaded as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java Database MBS Java Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Whether a driver has been loaded.

JavaDatabaseMBS.LoginTimeout as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Java Database MBS Java Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
The maximum time in seconds that a driver will wait while attempting to connect to a database.

The login time limit in seconds.
(Read and Write computed property)

JavaDatabaseMBS.println(message as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Java Database MBS Java Plugin 12.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Prints a message to the current JDBC log stream.

The items on this page are in the following plugins: MBS Java Plugin.


The biggest plugin in space...