package net.sourceforge.jdbclogger.oracle10g;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import net.sourceforge.jdbclogger.core.AbstractWrapperDriver;
import net.sourceforge.jdbclogger.core.formatters.NumberParameterFormatterImpl;
import net.sourceforge.jdbclogger.oracle10g.formatters.JdbcLoggerOracleDateParameterFormatterImpl;
import oracle.jdbc.driver.OracleConnection;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
/**
* @author Martin Marinschek (latest modification by $Author: sorin7486 $)
* @version $Revision: 115 $ $Date: 2007-07-19 17:41:41 +0800 (周四, 2007-07-19) $
*/
public class JdbcLoggerOracleDriver extends AbstractWrapperDriver
{
// This driver is compatible with the Oracle 10g release2 jdbc Driver
public JdbcLoggerOracleDriver() {
super();
formatters.add(new JdbcLoggerOracleDateParameterFormatterImpl());
formatters.add(new NumberParameterFormatterImpl());
}
public Connection connect(String s, Properties properties) throws SQLException{
if (getDriver() == null)
return null;
//has to return null if no connection available for compliance with the JDBC appi
OracleConnection con = (OracleConnection) getDriver().connect(s, properties);
if (con != null)
return new JdbcLoggerOracleConnectionWrapper(con, formatters);
return null;
}
}