KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > jdbc > Driver30


1 /*
2
3    Derby - Class org.apache.derby.jdbc.Driver30
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.jdbc;
23
24 import org.apache.derby.impl.jdbc.EmbedConnection;
25
26 import org.apache.derby.iapi.services.sanity.SanityManager;
27
28 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
29 import org.apache.derby.iapi.error.StandardException;
30 import org.apache.derby.iapi.jdbc.BrokeredConnection;
31 import org.apache.derby.iapi.jdbc.BrokeredConnection30;
32 import org.apache.derby.iapi.jdbc.BrokeredConnectionControl;
33 import java.sql.Connection JavaDoc;
34 import java.sql.SQLException JavaDoc;
35 import org.apache.derby.impl.jdbc.*;
36
37 import java.util.Properties JavaDoc;
38
39 /**
40     This class extends the local20 JDBC driver in order to determine at JBMS
41     boot-up if the JVM that runs us does support JDBC 3.0. If it is the case
42     then we will load the appropriate class(es) that have JDBC 3.0 new public
43     methods and sql types.
44  
45 */

46
47 public class Driver30 extends Driver20 {
48
49     /**
50      * Get a new nested connection.
51      *
52      * @param conn The EmbedConnection.
53      *
54      * @return A nested connection object.
55      *
56      */

57     public Connection getNewNestedConnection(EmbedConnection conn)
58     {
59         if (SanityManager.DEBUG)
60         {
61             SanityManager.ASSERT(conn instanceof EmbedConnection30,
62                 "conn expected to be instanceof EmbedConnection30");
63         }
64         return new EmbedConnection30(conn);
65     }
66
67     /*
68         Methods to be overloaded in sub-implementations such as
69         a tracing driver.
70   */

71     public EmbedConnection getNewEmbedConnection(String JavaDoc url, Properties JavaDoc info)
72          throws SQLException JavaDoc
73     {
74         return new EmbedConnection30(this, url, info);
75     }
76
77     /**
78         @exception SQLException if fails to create statement
79      */

80     public java.sql.PreparedStatement JavaDoc
81     newEmbedPreparedStatement (
82             EmbedConnection conn,
83             String JavaDoc stmt,
84             boolean forMetaData,
85             int resultSetType,
86             int resultSetConcurrency,
87             int resultSetHoldability,
88             int autoGeneratedKeys,
89             int[] columnIndexes,
90             String JavaDoc[] columnNames)
91     throws SQLException JavaDoc
92     {
93         return new EmbedPreparedStatement30(conn,
94                                 stmt,
95                                 forMetaData,
96                                 resultSetType,
97                                 resultSetConcurrency,
98                                 resultSetHoldability,
99                                 autoGeneratedKeys,
100                                 columnIndexes,
101                                 columnNames);
102     }
103
104     /**
105         @exception SQLException if fails to create statement
106      */

107     public java.sql.CallableStatement JavaDoc
108     newEmbedCallableStatement(
109             EmbedConnection conn,
110             String JavaDoc stmt,
111             int resultSetType,
112             int resultSetConcurrency,
113             int resultSetHoldability)
114     throws SQLException JavaDoc
115     {
116         return new EmbedCallableStatement30(conn,
117                                 stmt,
118                                 resultSetType,
119                                 resultSetConcurrency,
120                                 resultSetHoldability);
121     }
122     public BrokeredConnection newBrokeredConnection(BrokeredConnectionControl control) {
123
124         return new BrokeredConnection30(control);
125     }
126 }
127
Popular Tags