001: /*
002:
003: Derby - Class org.apache.derby.jdbc.Driver30
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.jdbc;
023:
024: import org.apache.derby.impl.jdbc.EmbedConnection;
025:
026: import org.apache.derby.iapi.services.sanity.SanityManager;
027:
028: import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
029: import org.apache.derby.iapi.error.StandardException;
030: import org.apache.derby.iapi.jdbc.BrokeredConnection;
031: import org.apache.derby.iapi.jdbc.BrokeredConnection30;
032: import org.apache.derby.iapi.jdbc.BrokeredConnectionControl;
033: import java.sql.Connection;
034: import java.sql.SQLException;
035: import org.apache.derby.impl.jdbc.*;
036:
037: import java.util.Properties;
038:
039: /**
040: This class extends the local20 JDBC driver in order to determine at JBMS
041: boot-up if the JVM that runs us does support JDBC 3.0. If it is the case
042: then we will load the appropriate class(es) that have JDBC 3.0 new public
043: methods and sql types.
044:
045: */
046:
047: public class Driver30 extends Driver20 {
048:
049: /**
050: * Get a new nested connection.
051: *
052: * @param conn The EmbedConnection.
053: *
054: * @return A nested connection object.
055: *
056: */
057: public Connection getNewNestedConnection(EmbedConnection conn) {
058: if (SanityManager.DEBUG) {
059: SanityManager.ASSERT(conn instanceof EmbedConnection30,
060: "conn expected to be instanceof EmbedConnection30");
061: }
062: return new EmbedConnection30(conn);
063: }
064:
065: /*
066: Methods to be overloaded in sub-implementations such as
067: a tracing driver.
068: */
069: public EmbedConnection getNewEmbedConnection(String url,
070: Properties info) throws SQLException {
071: return new EmbedConnection30(this , url, info);
072: }
073:
074: /**
075: @exception SQLException if fails to create statement
076: */
077: public java.sql.PreparedStatement newEmbedPreparedStatement(
078: EmbedConnection conn, String stmt, boolean forMetaData,
079: int resultSetType, int resultSetConcurrency,
080: int resultSetHoldability, int autoGeneratedKeys,
081: int[] columnIndexes, String[] columnNames)
082: throws SQLException {
083: return new EmbedPreparedStatement30(conn, stmt, forMetaData,
084: resultSetType, resultSetConcurrency,
085: resultSetHoldability, autoGeneratedKeys, columnIndexes,
086: columnNames);
087: }
088:
089: /**
090: @exception SQLException if fails to create statement
091: */
092: public java.sql.CallableStatement newEmbedCallableStatement(
093: EmbedConnection conn, String stmt, int resultSetType,
094: int resultSetConcurrency, int resultSetHoldability)
095: throws SQLException {
096: return new EmbedCallableStatement30(conn, stmt, resultSetType,
097: resultSetConcurrency, resultSetHoldability);
098: }
099:
100: public BrokeredConnection newBrokeredConnection(
101: BrokeredConnectionControl control) {
102:
103: return new BrokeredConnection30(control);
104: }
105: }
|