Source Code Cross Referenced for Driver.java in  » 6.0-JDK-Core » sql » java » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sql » java.sql 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1996-2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package java.sql;
027
028        /**
029         * The interface that every driver class must implement.
030         * <P>The Java SQL framework allows for multiple database drivers.
031         *
032         * <P>Each driver should supply a class that implements
033         * the Driver interface.
034         *
035         * <P>The DriverManager will try to load as many drivers as it can
036         * find and then for any given connection request, it will ask each
037         * driver in turn to try to connect to the target URL.
038         *
039         * <P>It is strongly recommended that each Driver class should be
040         * small and standalone so that the Driver class can be loaded and
041         * queried without bringing in vast quantities of supporting code.
042         *
043         * <P>When a Driver class is loaded, it should create an instance of
044         * itself and register it with the DriverManager. This means that a
045         * user can load and register a driver by calling
046         * <pre>
047         *   <code>Class.forName("foo.bah.Driver")</code>
048         * </pre>
049         *
050         * @see DriverManager
051         * @see Connection 
052         */
053        public interface Driver {
054
055            /**
056             * Attempts to make a database connection to the given URL.
057             * The driver should return "null" if it realizes it is the wrong kind
058             * of driver to connect to the given URL.  This will be common, as when
059             * the JDBC driver manager is asked to connect to a given URL it passes
060             * the URL to each loaded driver in turn.
061             *
062             * <P>The driver should throw an <code>SQLException</code> if it is the right 
063             * driver to connect to the given URL but has trouble connecting to
064             * the database.
065             *
066             * <P>The <code>java.util.Properties</code> argument can be used to pass
067             * arbitrary string tag/value pairs as connection arguments.
068             * Normally at least "user" and "password" properties should be
069             * included in the <code>Properties</code> object.
070             *
071             * @param url the URL of the database to which to connect
072             * @param info a list of arbitrary string tag/value pairs as
073             * connection arguments. Normally at least a "user" and
074             * "password" property should be included.
075             * @return a <code>Connection</code> object that represents a
076             *         connection to the URL
077             * @exception SQLException if a database access error occurs
078             */
079            Connection connect(String url, java.util.Properties info)
080                    throws SQLException;
081
082            /**
083             * Retrieves whether the driver thinks that it can open a connection
084             * to the given URL.  Typically drivers will return <code>true</code> if they
085             * understand the subprotocol specified in the URL and <code>false</code> if
086             * they do not.
087             *
088             * @param url the URL of the database
089             * @return <code>true</code> if this driver understands the given URL;
090             *         <code>false</code> otherwise  
091             * @exception SQLException if a database access error occurs
092             */
093            boolean acceptsURL(String url) throws SQLException;
094
095            /**
096             * Gets information about the possible properties for this driver.
097             * <P>
098             * The <code>getPropertyInfo</code> method is intended to allow a generic 
099             * GUI tool to discover what properties it should prompt 
100             * a human for in order to get 
101             * enough information to connect to a database.  Note that depending on
102             * the values the human has supplied so far, additional values may become
103             * necessary, so it may be necessary to iterate though several calls
104             * to the <code>getPropertyInfo</code> method.
105             *
106             * @param url the URL of the database to which to connect
107             * @param info a proposed list of tag/value pairs that will be sent on
108             *          connect open
109             * @return an array of <code>DriverPropertyInfo</code> objects describing 
110             *          possible properties.  This array may be an empty array if 
111             *          no properties are required.
112             * @exception SQLException if a database access error occurs
113             */
114            DriverPropertyInfo[] getPropertyInfo(String url,
115                    java.util.Properties info) throws SQLException;
116
117            /**
118             * Retrieves the driver's major version number. Initially this should be 1.
119             *
120             * @return this driver's major version number
121             */
122            int getMajorVersion();
123
124            /**
125             * Gets the driver's minor version number. Initially this should be 0.
126             * @return this driver's minor version number
127             */
128            int getMinorVersion();
129
130            /**
131             * Reports whether this driver is a genuine JDBC
132             * Compliant<sup><font size=-2>TM</font></sup> driver.
133             * A driver may only report <code>true</code> here if it passes the JDBC
134             * compliance tests; otherwise it is required to return <code>false</code>.
135             * <P>
136             * JDBC compliance requires full support for the JDBC API and full support
137             * for SQL 92 Entry Level.  It is expected that JDBC compliant drivers will
138             * be available for all the major commercial databases.
139             * <P>
140             * This method is not intended to encourage the development of non-JDBC
141             * compliant drivers, but is a recognition of the fact that some vendors
142             * are interested in using the JDBC API and framework for lightweight
143             * databases that do not support full database functionality, or for
144             * special databases such as document information retrieval where a SQL
145             * implementation may not be feasible.
146             * @return <code>true</code> if this driver is JDBC Compliant; <code>false</code>
147             *         otherwise
148             */
149            boolean jdbcCompliant();
150        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.