Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Firebird Open Source J2ee connector - jdbc driver
  *
  * Distributable under LGPL license.
  * You may obtain a copy of the License at http://www.gnu.org/copyleft/lgpl.html
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * LGPL License for more details.
 *
 * This file was created by members of the firebird development team.
 * All individual contributions remain the Copyright (C) of those
 * individuals.  Contributors to this file are either listed here or
 * can be obtained from a CVS history command.
 *
 * All rights reserved.
 */
package org.firebirdsql.pool;
This is simple implementation of javax.sql.DataSource interface that uses javax.sql.ConnectionPoolDataSource as connection provider.

Deprecated:
Use FBSimpleDataSource for non-pooling, this implementation only works correctly with the deprecated FBConnectionPoolDataSource and DriverConnectionPoolDataSource classes
Author(s):
Roman Rokytskyy
public class SimpleDataSource extends RootCommonDataSource implements DataSource {
	private int timeout;

Create instance of this class.

Parameters:
pool instance of javax.sql.ConnectionPoolDataSource that will provide connections to this data source.
		this. = pool;
	}

Get JDBC connection.

Returns:
instance of java.sql.Connection from this data source.
Throws:
java.sql.SQLException if connection cannot be obtained.
    public Connection getConnection() throws SQLException {
    }

Get JDBC connection for the specified username and password.

Parameters:
username username for new connection.
password password corresponding to the username.
Returns:
instance of java.sql.Connection.
Throws:
java.sql.SQLException if connection cannot be obtained.
    public Connection getConnection(String usernameString passwordthrows SQLException {
		return .getPooledConnection(usernamepassword).getConnection();
    }
    public int getLoginTimeout() throws SQLException {
		return ;
    }
    public void setLoginTimeout(int secondsthrows SQLException {
		this. = seconds;
    }
    // JDBC 4.0
    
    public boolean isWrapperFor(Class ifacethrows SQLException {
    	return false;
    }
    
    public Object unwrap(Class ifacethrows SQLException {
    	throw new FBDriverNotCapableException();
    }
    
New to GrepCode? Check out our FAQ X