Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

JavaDatabaseMBS.connect(url as string) as JavaConnectionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Java Database MBS Java Plugin 12.1 Yes Yes Yes Yes No
Function: Connects directly to the database calling the Drivers's connect method.
Notes:
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

Feedback, Comments & Corrections

JavaDatabaseMBS.Constructor(vm as JavaVMMBS, driverclass as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Java Database MBS Java Plugin 8.5 Yes Yes Yes Yes No
Function: 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")
Notes: The driverclass is the name of the main class of the jdbc driver.

Feedback, Comments & Corrections

JavaDatabaseMBS.getConnection(url as string) as JavaConnectionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Java Database MBS Java Plugin 8.5 Yes Yes Yes Yes No
Function: 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")
Notes:
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:

Feedback, Comments & Corrections

JavaDatabaseMBS.getConnection(url as string, username as string, password as string) as JavaConnectionMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Java Database MBS Java Plugin 8.5 Yes Yes Yes Yes No
Function: 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")
Notes:
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:

Feedback, Comments & Corrections

JavaDatabaseMBS.IsDriverLoaded as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Java Database MBS Java Plugin 8.3 Yes Yes Yes Yes No
Function: Whether a driver has been loaded.

Feedback, Comments & Corrections

JavaDatabaseMBS.LoginTimeout as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Java Database MBS Java Plugin 8.5 Yes Yes Yes Yes No
Function: The maximum time in seconds that a driver will wait while attempting to connect to a database.
Notes:
The login time limit in seconds.
(Read and Write computed property)

Feedback, Comments & Corrections

JavaDatabaseMBS.println(message as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Java Database MBS Java Plugin 12.1 Yes Yes Yes Yes No
Function: Prints a message to the current JDBC log stream.

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins