mn8 Language Reference | Index | ||
JDBCClient |
||
|
||
The basic service for managing a set of JDBC drivers. As part of its initialization, the JDBCClient concept will attempt to load the driver classes referenced in the "jdbc.drivers" system property. This allows the users to customize JDBC Drivers used by their applications.
For example, if you want to load the org.postgresql.Driver, in the parameter of the method getConnection you can add a Map item with key 'className', where value is the driver class name.
When the method getConnection is called, the JDBCClient will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current application.
$param typeof Map $param.add("className", "org.postgresql.Driver") $param.add("url", "jdbc:postgresql:testdb") $param.add("user", "root") $param.add("passwd", "") $con = JDBCClient.getConnection( $param )
Version: | 0.1 |
Authors: | Szabo Csaba () |
Location: | |
Inherits: | Concept |
static JDBCConnection | getConnection (Map $map) |
static getConnection (Map $map) |
Parameters: | ||
|
Returns: JDBCConnection |
Exceptions: | |||||||
classNameException : (Error) | if parameter 'className' is missing. |
classNotFoundException : (Error) | if unable to load specified class. |
badURLException : (Error) | if parameter 'url' is missing. |
connectionException : (Error) | if a database access error occurs. |
Attempts to establish a connection to the given database URL. The JDBCClient attempts to select an appropriate driver from the set of registered JDBC drivers.
$param typeof Map $param.add("className", "org.postgresql.Driver") $param.add("url", "jdbc:postgresql:testdb") $param.add("user", "root") $param.add("passwd", "") $con = JDBCClient.getConnection( $param ) print $con.getConceptType -- the result is -- JDBCConnection