Source Code Cross Referenced for LogicalConnection40.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » client » am » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.client.am 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.client.am.LogicalConnection40
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.client.am;
023:
024:        import java.sql.Array;
025:        import java.sql.Blob;
026:        import java.sql.SQLClientInfoException;
027:        import java.sql.Clob;
028:        import java.sql.NClob;
029:        import java.sql.SQLXML;
030:        import java.sql.SQLException;
031:        import java.sql.Struct;
032:        import java.sql.Wrapper;
033:        import java.util.Properties;
034:
035:        import org.apache.derby.client.ClientPooledConnection;
036:        import org.apache.derby.shared.common.reference.SQLState;
037:        import java.util.Map;
038:
039:        /**
040:         * A simple delegation wrapper handle for a physical connection.
041:         * This class only contains JDBC 4.0 specific methods.
042:         *
043:         * NOTE: All non-implemented JDBC 4.0 methods are located here, but when they
044:         *       are implemented, they should be moved to the superclass if possible.
045:         */
046:        public class LogicalConnection40 extends LogicalConnection {
047:
048:            public LogicalConnection40(Connection physicalConnection,
049:                    ClientPooledConnection pooledConnection)
050:                    throws SqlException {
051:                super (physicalConnection, pooledConnection);
052:            }
053:
054:            public Array createArrayOf(String typeName, Object[] elements)
055:                    throws SQLException {
056:                checkForNullPhysicalConnection();
057:                return physicalConnection_.createArrayOf(typeName, elements);
058:            }
059:
060:            public Blob createBlob() throws SQLException {
061:                checkForNullPhysicalConnection();
062:                return physicalConnection_.createBlob();
063:            }
064:
065:            public Clob createClob() throws SQLException {
066:                checkForNullPhysicalConnection();
067:                return physicalConnection_.createClob();
068:            }
069:
070:            public NClob createNClob() throws SQLException {
071:                checkForNullPhysicalConnection();
072:                return physicalConnection_.createNClob();
073:            }
074:
075:            public SQLXML createSQLXML() throws SQLException {
076:                checkForNullPhysicalConnection();
077:                return physicalConnection_.createSQLXML();
078:            }
079:
080:            public Struct createStruct(String typeName, Object[] attributes)
081:                    throws SQLException {
082:                checkForNullPhysicalConnection();
083:                return physicalConnection_.createStruct(typeName, attributes);
084:            }
085:
086:            /**
087:             * <code>getClientInfo</code> forwards to
088:             * <code>physicalConnection_</code>.
089:             * <code>getClientInfo</code> always returns an empty
090:             * <code>Properties</code> object since Derby doesn't support
091:             * ClientInfoProperties.
092:             *
093:             * @return an empty <code>Properties</code> object
094:             * @exception SQLException if an error occurs
095:             */
096:            public Properties getClientInfo() throws SQLException {
097:                checkForNullPhysicalConnection();
098:                return physicalConnection_.getClientInfo();
099:            }
100:
101:            /**
102:             * <code>getClientInfo</code> forwards to
103:             * <code>physicalConnection_</code>. Always returns a <code>null
104:             * String</code> since Derby does not support
105:             * ClientInfoProperties.
106:             *
107:             * @param name a property key to get <code>String</code>
108:             * @return a property value <code>String</code>
109:             * @exception SQLException if an error occurs
110:             */
111:            public String getClientInfo(String name) throws SQLException {
112:                checkForNullPhysicalConnection();
113:                return physicalConnection_.getClientInfo(name);
114:            }
115:
116:            /**
117:             * Returns the type map for this connection.
118:             *
119:             * @return type map for this connection
120:             * @exception SQLException if a database access error occurs
121:             */
122:            public Map<String, Class<?>> getTypeMap() throws SQLException {
123:                checkForNullPhysicalConnection();
124:                return ((java.sql.Connection) physicalConnection_).getTypeMap();
125:            }
126:
127:            /**
128:             * Checks if the connection has not been closed and is still valid. 
129:             * The validity is checked by running a simple query against the 
130:             * database.
131:             *
132:             * @param timeout The time in seconds to wait for the database
133:             * operation used to validate the connection to complete. If the 
134:             * timeout period expires before the operation completes, this 
135:             * method returns false. A value of 0 indicates a timeout is not 
136:             * applied to the database operation.
137:             * @return true if the connection is valid, false otherwise
138:             * @throws SQLException if the call on the physical connection throws an
139:             * exception.
140:             */
141:            synchronized public boolean isValid(int timeout)
142:                    throws SQLException {
143:                // Check if we have a underlying physical connection
144:                if (physicalConnection_ == null) {
145:                    return false;
146:                }
147:                return physicalConnection_.isValid(timeout);
148:            }
149:
150:            public boolean isWrapperFor(Class<?> interfaces)
151:                    throws SQLException {
152:                checkForNullPhysicalConnection();
153:                return interfaces.isInstance(this );
154:            }
155:
156:            /**
157:             * <code>setClientInfo</code> forwards to
158:             * <code>physicalConnection_</code>.
159:             *
160:             * @param properties a <code>Properties</code> object with the
161:             * properties to set
162:             * @exception SQLClientInfoException if an error occurs
163:             */
164:            public void setClientInfo(Properties properties)
165:                    throws SQLClientInfoException {
166:                try {
167:                    checkForNullPhysicalConnection();
168:                } catch (SQLException se) {
169:                    throw new SQLClientInfoException(se.getMessage(), se
170:                            .getSQLState(),
171:                            (new FailedProperties40(properties))
172:                                    .getProperties());
173:                }
174:                physicalConnection_.setClientInfo(properties);
175:            }
176:
177:            /**
178:             * <code>setClientInfo</code> forwards to
179:             * <code>physicalConnection_</code>.
180:             *
181:             * @param name a property key <code>String</code>
182:             * @param value a property value <code>String</code>
183:             * @exception SQLException if an error occurs
184:             */
185:            public void setClientInfo(String name, String value)
186:                    throws SQLClientInfoException {
187:                try {
188:                    checkForNullPhysicalConnection();
189:                } catch (SQLException se) {
190:                    throw new SQLClientInfoException(se.getMessage(), se
191:                            .getSQLState(), new FailedProperties40(
192:                            FailedProperties40.makeProperties(name, value))
193:                            .getProperties());
194:                }
195:                physicalConnection_.setClientInfo(name, value);
196:            }
197:
198:            public <T> T unwrap(Class<T> interfaces) throws SQLException {
199:                checkForNullPhysicalConnection();
200:                // Derby does not implement non-standard methods on JDBC objects
201:                try {
202:                    return interfaces.cast(this );
203:                } catch (ClassCastException cce) {
204:                    throw new SqlException(null, new ClientMessageId(
205:                            SQLState.UNABLE_TO_UNWRAP), interfaces)
206:                            .getSQLException();
207:                }
208:            }
209:
210:        } // End class LogicalConnection40
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.