org.mmbase.storage.implementation.database
Class GenericDataSource

java.lang.Object
  extended byorg.mmbase.storage.implementation.database.GenericDataSource
All Implemented Interfaces:
DataSource

public final class GenericDataSource
extends Object
implements DataSource

This class functions as a Datasource wrapper around the JDBC Module. It is intended for use when MMBase runs outside an applicationserver, or when the server does not (or poorly) support pooled datasources. I can also be used by older systems that use the JDBC Module and do not want to change their configuration. Note that the JDBC Module will likely be fased out as a module at some point in the future, with code and supporting classes to be moved to this class instead.

Since:
MMBase-1.7
Version:
$Id: GenericDataSource.java,v 1.12 2006/07/15 14:35:06 michiel Exp $
Author:
Pierre van Rooden, Michiel Meeuwissen

Method Summary
 Connection getConnection()
           
 Connection getConnection(String userName, String password)
           
 Connection getDirectConnection()
           
 int getLoginTimeout()
           
 PrintWriter getLogWriter()
           
protected  String makeUrl()
          Makes URL which can be used to produce a Conncetion.
 void setLoginTimeout(int seconds)
           Note: currently this code does not actually change the timeout.
 void setLogWriter(PrintWriter out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getDirectConnection

public Connection getDirectConnection()
                               throws SQLException
Throws:
SQLException
Since:
MMBase-1.8

getConnection

public Connection getConnection(String userName,
                                String password)
                         throws SQLException
Specified by:
getConnection in interface DataSource
Throws:
SQLException

getLoginTimeout

public int getLoginTimeout()
Specified by:
getLoginTimeout in interface DataSource

getLogWriter

public PrintWriter getLogWriter()
Specified by:
getLogWriter in interface DataSource

setLoginTimeout

public void setLoginTimeout(int seconds)
Note: currently this code does not actually change the timeout. Login timeout is not implemented by JDBC module

Specified by:
setLoginTimeout in interface DataSource

setLogWriter

public void setLogWriter(PrintWriter out)
Specified by:
setLogWriter in interface DataSource

makeUrl

protected String makeUrl()
Makes URL which can be used to produce a Conncetion. If this is a 'meta' datasource, then 'lookup.xml' will be tried, for a 'meta url'.

Since:
MMBase-1.8


MMBase build 1.8.1.20060716