FileDocCategorySizeDatePackage
DataSourceWrapper.javaAPI DocGlassfish v2 API4676Sat May 05 19:17:54 BST 2007org.apache.taglibs.standard.tag.common.sql

DataSourceWrapper

public class DataSourceWrapper extends Object implements DataSource

A simple DataSource wrapper for the standard DriverManager class.

author
Hans Bergsten

Fields Summary
private String
driverClassName
private String
jdbcURL
private String
userName
private String
password
Constructors Summary
Methods Summary
public java.sql.ConnectiongetConnection()
Returns a Connection using the DriverManager and all set properties.

	Connection conn = null;
	if (userName != null) {
	    conn = DriverManager.getConnection(jdbcURL, userName, password);
	}
	else {
	    conn = DriverManager.getConnection(jdbcURL);
	}
	return conn;
    
public java.sql.ConnectiongetConnection(java.lang.String username, java.lang.String password)
Always throws a SQLException. Username and password are set in the constructor and can not be changed.

        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
    
public java.io.PrintWritergetLogWriter()
Always throws a SQLException. Not supported.

        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
    
public intgetLoginTimeout()
Always throws a SQLException. Not supported.

        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
    
public voidsetDriverClassName(java.lang.String driverClassName)


	this.driverClassName = driverClassName;
        Class.forName(driverClassName, true, 
            Thread.currentThread().getContextClassLoader()).newInstance();
    
public voidsetJdbcURL(java.lang.String jdbcURL)

	this.jdbcURL = jdbcURL;
    
public synchronized voidsetLogWriter(java.io.PrintWriter out)
Always throws a SQLException. Not supported.

        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
    
public voidsetLoginTimeout(int seconds)
Always throws a SQLException. Not supported.

        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
    
public voidsetPassword(java.lang.String password)

	this.password = password;
    
public voidsetUserName(java.lang.String userName)

	this.userName = userName;