|
|||||||||
| Home >> All >> com >> mysql >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mysql.jdbc
Class NonRegisteringDriver

java.lang.Objectcom.mysql.jdbc.NonRegisteringDriver
- All Implemented Interfaces:
- java.sql.Driver
- Direct Known Subclasses:
- Driver
- public class NonRegisteringDriver
- extends java.lang.Object
- implements java.sql.Driver
- extends java.lang.Object
The Java SQL framework allows for multiple database drivers. Each driver should supply a class that implements the Driver interface
The DriverManager will try to load as many drivers as it can find and then for any given connection request, it will ask each driver in turn to try to connect to the target URL.
It is strongly recommended that each Driver class should be small and standalone so that the Driver class can be loaded and queried without bringing in vast quantities of supporting code.
When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register a driver by doing Class.forName("foo.bah.Driver")
- Version:
- $Id: NonRegisteringDriver.java,v 1.1.2.20 2004/08/09 22:15:12 mmatthew Exp $
| Field Summary | |
static boolean |
DEBUG
Should the driver generate debugging output? |
protected static int |
HOST_NAME_INDEX
Index for hostname coming out of parseHostPortPair(). |
protected static int |
PORT_NUMBER_INDEX
Index for port # coming out of parseHostPortPair(). |
static boolean |
TRACE
Should the driver generate method-call traces? |
| Constructor Summary | |
NonRegisteringDriver()
Construct a new driver and register it with DriverManager |
|
| Method Summary | |
boolean |
acceptsURL(java.lang.String url)
Typically, drivers will return true if they understand the subprotocol specified in the URL and false if they don't. |
java.sql.Connection |
connect(java.lang.String url,
java.util.Properties info)
Try to make a database connection to the given URL. |
java.lang.String |
database(java.util.Properties props)
Returns the database property from props |
int |
getMajorVersion()
Gets the drivers major version number |
(package private) static int |
getMajorVersionInternal()
Gets the drivers major version number |
int |
getMinorVersion()
Get the drivers minor version number |
(package private) static int |
getMinorVersionInternal()
Get the drivers minor version number |
java.sql.DriverPropertyInfo[] |
getPropertyInfo(java.lang.String url,
java.util.Properties info)
The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. |
java.lang.String |
host(java.util.Properties props)
Returns the hostname property |
boolean |
jdbcCompliant()
Report whether the driver is a genuine JDBC compliant driver. |
protected static java.lang.String[] |
parseHostPortPair(java.lang.String hostPortPair)
Parses hostPortPair in the form of [host][:port] into an array, with the element of index HOST_NAME_INDEX being the host (or null if not specified), and the element of index PORT_NUMBER_INDEX being the port (or null if not specified). |
java.util.Properties |
parseURL(java.lang.String url,
java.util.Properties defaults)
Constructs a new DriverURL, splitting the specified URL into its component parts |
int |
port(java.util.Properties props)
Returns the port number property |
java.lang.String |
property(java.lang.String name,
java.util.Properties props)
Returns the given property from props |
private static int |
safeIntParse(java.lang.String intAsString)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
DEBUG
public static final boolean DEBUG
- Should the driver generate debugging output?
- See Also:
- Constant Field Values
TRACE
public static final boolean TRACE
- Should the driver generate method-call traces?
- See Also:
- Constant Field Values
HOST_NAME_INDEX
protected static final int HOST_NAME_INDEX
- Index for hostname coming out of parseHostPortPair().
- See Also:
- Constant Field Values
PORT_NUMBER_INDEX
protected static final int PORT_NUMBER_INDEX
- Index for port # coming out of parseHostPortPair().
- See Also:
- Constant Field Values
| Constructor Detail |
NonRegisteringDriver
public NonRegisteringDriver()
throws java.sql.SQLException
- Construct a new driver and register it with DriverManager
| Method Detail |
getMajorVersion
public int getMajorVersion()
- Gets the drivers major version number
- Specified by:
getMajorVersionin interfacejava.sql.Driver
getMinorVersion
public int getMinorVersion()
- Get the drivers minor version number
- Specified by:
getMinorVersionin interfacejava.sql.Driver
getPropertyInfo
public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
- The getPropertyInfo method is intended to allow a generic GUI tool to
discover what properties it should prompt a human for in order to get
enough information to connect to a database.
Note that depending on the values the human has supplied so far, additional values may become necessary, so it may be necessary to iterate through several calls to getPropertyInfo
- Specified by:
getPropertyInfoin interfacejava.sql.Driver
acceptsURL
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
- Typically, drivers will return true if they understand the subprotocol
specified in the URL and false if they don't. This driver's protocols
start with jdbc:mysql:
- Specified by:
acceptsURLin interfacejava.sql.Driver
connect
public java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
- Try to make a database connection to the given URL. The driver should
return "null" if it realizes it is the wrong kind of driver to connect
to the given URL. This will be common, as when the JDBC driverManager
is asked to connect to a given URL, it passes the URL to each loaded
driver in turn.
The driver should raise an java.sql.SQLException if it is the right driver to connect to the given URL, but has trouble connecting to the database.
The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments.
My protocol takes the form:
jdbc:mysql://host:port/database- Specified by:
connectin interfacejava.sql.Driver
database
public java.lang.String database(java.util.Properties props)
- Returns the database property from
props
host
public java.lang.String host(java.util.Properties props)
- Returns the hostname property
jdbcCompliant
public boolean jdbcCompliant()
- Report whether the driver is a genuine JDBC compliant driver. A driver
may only report "true" here if it passes the JDBC compliance tests,
otherwise it is required to return false. JDBC compliance requires
full support for the JDBC API and full support for SQL 92 Entry Level.
MySQL is not SQL92 compliant
- Specified by:
jdbcCompliantin interfacejava.sql.Driver
parseURL
public java.util.Properties parseURL(java.lang.String url, java.util.Properties defaults) throws java.sql.SQLException
- Constructs a new DriverURL, splitting the specified URL into its
component parts
port
public int port(java.util.Properties props)
- Returns the port number property
property
public java.lang.String property(java.lang.String name, java.util.Properties props)
- Returns the given property from
props
parseHostPortPair
protected static java.lang.String[] parseHostPortPair(java.lang.String hostPortPair) throws java.sql.SQLException
- Parses hostPortPair in the form of [host][:port] into an array, with
the element of index HOST_NAME_INDEX being the host (or null if not
specified), and the element of index PORT_NUMBER_INDEX being the port
(or null if not specified).
getMajorVersionInternal
static int getMajorVersionInternal()
- Gets the drivers major version number
getMinorVersionInternal
static int getMinorVersionInternal()
- Get the drivers minor version number
safeIntParse
private static int safeIntParse(java.lang.String intAsString)
|
|||||||||
| Home >> All >> com >> mysql >> [ jdbc overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.mysql.jdbc.NonRegisteringDriver