Source Code Cross Referenced for tinySQLDriver.java in  » Database-DBMS » TinySQL » com » sqlmagic » tinysql » 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 » TinySQL » com.sqlmagic.tinysql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * tinySQLDriver - the tinySQLDriver abstract class
003:         *
004:         * A lot of this code is based on or directly taken from
005:         * George Reese's (borg@imaginary.com) mSQL driver.
006:         *
007:         * So, it's probably safe to say:
008:         *
009:         * Portions of this code Copyright (c) 1996 George Reese
010:         *
011:         * The rest of it:
012:         *
013:         * Copyright 1996, Brian C. Jepson
014:         *                 (bjepson@ids.net)
015:         * $Author: davis $
016:         * $Date: 2004/12/18 21:27:06 $
017:         * $Revision: 1.1 $
018:         *
019:         * This library is free software; you can redistribute it and/or
020:         * modify it under the terms of the GNU Lesser General Public
021:         * License as published by the Free Software Foundation; either
022:         * version 2.1 of the License, or (at your option) any later version.
023:         *
024:         * This library is distributed in the hope that it will be useful,
025:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
026:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027:         * Lesser General Public License for more details.
028:         *
029:         * You should have received a copy of the GNU Lesser General Public
030:         * License along with this library; if not, write to the Free Software
031:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
032:         */
033:
034:        package com.sqlmagic.tinysql;
035:
036:        import java.sql.Connection;
037:        import java.sql.DriverPropertyInfo;
038:        import java.sql.SQLException;
039:        import java.sql.Driver;
040:        import java.util.Properties;
041:
042:        public abstract class tinySQLDriver implements  java.sql.Driver {
043:
044:            /**
045:             *
046:             * Constructs a new tinySQLDriver
047:             *
048:             */
049:            public tinySQLDriver() {
050:            }
051:
052:            /**
053:             *
054:             * Check the syntax of the URL.
055:             * @see java.sql.Driver#connect
056:             * @param url the URL for the database in question
057:             * @param info the properties object
058:             * @return null if the URL should be ignored, or a new Connection
059:             *         object if the URL is a valid tinySQL URL
060:             *
061:             */
062:            public Connection connect(String url, Properties info)
063:                    throws SQLException {
064:
065:                if (!acceptsURL(url)) {
066:                    return null;
067:                }
068:
069:                // if it was a valid URL, return the new Connection
070:                //
071:                return getConnection(info.getProperty("user"), url, this );
072:            }
073:
074:            /**
075:             *
076:             * Check to see if the URL is a tinySQL URL. It should start
077:             * with jdbc:tinySQL in order to qualify.
078:             *
079:             * @param url The URL of the database.
080:             * @return True if this driver can connect to the given URL.
081:             *
082:             */
083:            public boolean acceptsURL(String url) throws SQLException {
084:
085:                // make sure the length is at least twelve
086:                // before bothering with the substring
087:                // comparison.
088:                //
089:                if (url.length() < 12) {
090:                    return false;
091:                }
092:
093:                // if everything after the jdbc: part is
094:                // tinySQL, then return true.
095:                //
096:                return url.substring(5, 12).equals("tinySQL");
097:
098:            }
099:
100:            /**
101:             *
102:             * The getPropertyInfo method is intended to allow a generic GUI tool to
103:             * discover what properties it should prompt a human for in order to get
104:             * enough information to connect to a database.  Note that depending on
105:             * the values the human has supplied so far, additional values may become
106:             * necessary, so it may be necessary to iterate though several calls
107:             * to getPropertyInfo.
108:             *
109:             * @param url The URL of the database to connect to.
110:             * @param info A proposed list of tag/value pairs that will be sent on
111:             *          connect open.
112:             * @return An array of DriverPropertyInfo objects describing possible
113:             *          properties.  This array may be an empty array if no properties
114:             *          are required.
115:             *
116:             */
117:            public DriverPropertyInfo[] getPropertyInfo(String url,
118:                    java.util.Properties info) throws SQLException {
119:                return new DriverPropertyInfo[0];
120:            }
121:
122:            /**
123:             *
124:             * Gets the driver's major version number.
125:             * @see java.sql.Driver#getMajorVersion
126:             * @return the major version
127:             *
128:             */
129:            public int getMajorVersion() {
130:                return 0;
131:            }
132:
133:            /**
134:             *
135:             * Gets the driver's minor version
136:             * @see java.sql.Driver#getMinorVersion
137:             * @return the minor version
138:             *
139:             */
140:            public int getMinorVersion() {
141:                return 9;
142:            }
143:
144:            /**
145:             *
146:             * Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.
147:             * Unfortunately, the tinySQL is "sub-compliant" :-(
148:             * 
149:             */
150:            public boolean jdbcCompliant() {
151:                return false;
152:            }
153:
154:            /**
155:             *
156:             * Abstract method to return a tinySQLConnection object, typically
157:             * a subclass of the abstract class tinySQLConnection.
158:             *
159:             */
160:            public abstract tinySQLConnection getConnection(String user,
161:                    String url, Driver d) throws SQLException;
162:
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.