1 | /* |
2 | |
3 | Derby - Class org.apache.derby.jdbc.Driver30 |
4 | |
5 | Copyright 2001, 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.jdbc; |
22 | |
23 | import org.apache.derby.impl.jdbc.EmbedConnection; |
24 | |
25 | import org.apache.derby.iapi.services.sanity.SanityManager; |
26 | |
27 | import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; |
28 | import org.apache.derby.iapi.error.StandardException; |
29 | import org.apache.derby.iapi.jdbc.BrokeredConnection; |
30 | import org.apache.derby.iapi.jdbc.BrokeredConnection30; |
31 | import org.apache.derby.iapi.jdbc.BrokeredConnectionControl; |
32 | import java.sql.Connection; |
33 | import java.sql.SQLException; |
34 | import org.apache.derby.impl.jdbc.*; |
35 | |
36 | import java.util.Properties; |
37 | |
38 | /** |
39 | This class extends the local20 JDBC driver in order to determine at JBMS |
40 | boot-up if the JVM that runs us does support JDBC 3.0. If it is the case |
41 | then we will load the appropriate class(es) that have JDBC 3.0 new public |
42 | methods and sql types. |
43 | |
44 | */ |
45 | |
46 | public class Driver30 extends Driver20 { |
47 | |
48 | /** |
49 | * Get a new nested connection. |
50 | * |
51 | * @param conn The EmbedConnection. |
52 | * |
53 | * @return A nested connection object. |
54 | * |
55 | */ |
56 | public Connection getNewNestedConnection(EmbedConnection conn) |
57 | { |
58 | if (SanityManager.DEBUG) |
59 | { |
60 | SanityManager.ASSERT(conn instanceof EmbedConnection30, |
61 | "conn expected to be instanceof EmbedConnection30"); |
62 | } |
63 | return new EmbedConnection30(conn); |
64 | } |
65 | |
66 | /* |
67 | Methods to be overloaded in sub-implementations such as |
68 | a tracing driver. |
69 | */ |
70 | public EmbedConnection getNewEmbedConnection(String url, Properties info) |
71 | throws SQLException |
72 | { |
73 | return new EmbedConnection30(this, url, info); |
74 | } |
75 | |
76 | /** |
77 | @exception SQLException if fails to create statement |
78 | */ |
79 | public java.sql.PreparedStatement |
80 | newEmbedPreparedStatement ( |
81 | EmbedConnection conn, |
82 | String stmt, |
83 | boolean forMetaData, |
84 | int resultSetType, |
85 | int resultSetConcurrency, |
86 | int resultSetHoldability, |
87 | int autoGeneratedKeys, |
88 | int[] columnIndexes, |
89 | String[] columnNames) |
90 | throws SQLException |
91 | { |
92 | return new EmbedPreparedStatement30(conn, |
93 | stmt, |
94 | forMetaData, |
95 | resultSetType, |
96 | resultSetConcurrency, |
97 | resultSetHoldability, |
98 | autoGeneratedKeys, |
99 | columnIndexes, |
100 | columnNames); |
101 | } |
102 | |
103 | /** |
104 | @exception SQLException if fails to create statement |
105 | */ |
106 | public java.sql.CallableStatement |
107 | newEmbedCallableStatement( |
108 | EmbedConnection conn, |
109 | String stmt, |
110 | int resultSetType, |
111 | int resultSetConcurrency, |
112 | int resultSetHoldability) |
113 | throws SQLException |
114 | { |
115 | return new EmbedCallableStatement30(conn, |
116 | stmt, |
117 | resultSetType, |
118 | resultSetConcurrency, |
119 | resultSetHoldability); |
120 | } |
121 | public BrokeredConnection newBrokeredConnection(BrokeredConnectionControl control) { |
122 | |
123 | return new BrokeredConnection30(control); |
124 | } |
125 | } |