mn8 Language Reference | Index    

JDBCClient

SUMMARY: NO ATTRIBUTES  NO ELEMENTS  NO CONSTRUCTORS  NO OPERATORS  METHODS SUMMARYDETAIL: NO ATTRIBUTES  NO ELEMENTS  NO CONSTRUCTORS  NO OPERATORS  METHOD DETAILS

Description

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.

Usage

        $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

Method List

static JDBCConnectiongetConnection (Map $map)
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI

Detailed Method Info

static getConnection (Map $map)
Parameters:
$map :a Map concept that contains items for JDBC connection.
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
             

top