| |
|
| java.lang.Object com.mysql.jdbc.NonRegisteringDriver
NonRegisteringDriver | public class NonRegisteringDriver implements java.sql.Driver(Code) | | 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")
author: Mark Matthews version: $Id: NonRegisteringDriver.java,v 1.1.2.1 2005/05/13 18:58:38 version: mmatthews Exp $ See Also: org.gjt.mm.mysql.Connection See Also: java.sql.Driver |
Method Summary | |
public boolean | acceptsURL(String url) Typically, drivers will return true if they understand the subprotocol
specified in the URL and false if they don't. | public java.sql.Connection | connect(String url, Properties info) Try to make a database connection to the given URL. | public String | database(Properties props) Returns the database property from props
Parameters: props - the Properties to look for the database property. | public int | getMajorVersion() | static int | getMajorVersionInternal() | public int | getMinorVersion() | static int | getMinorVersionInternal() | public DriverPropertyInfo[] | getPropertyInfo(String url, 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.
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
Parameters: url - the Url of the database to connect to Parameters: info - a proposed list of tag/value pairs that will be sent onconnect open. | public String | host(Properties props) Returns the hostname property
Parameters: props - the java.util.Properties instance to retrieve the hostnamefrom. | public boolean | jdbcCompliant() Report whether the driver is a genuine JDBC compliant driver. | protected static String[] | parseHostPortPair(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). | public Properties | parseURL(String url, Properties defaults) | public int | port(Properties props) | public String | property(String name, Properties props) |
DBNAME_PROPERTY_KEY | final public static String DBNAME_PROPERTY_KEY(Code) | | Key used to retreive the database value from the properties instance
passed to the driver.
|
DEBUG | final public static boolean DEBUG(Code) | | Should the driver generate debugging output?
|
HOST_NAME_INDEX | final public static int HOST_NAME_INDEX(Code) | | Index for hostname coming out of parseHostPortPair().
|
HOST_PROPERTY_KEY | final public static String HOST_PROPERTY_KEY(Code) | | Key used to retreive the hostname value from the properties instance
passed to the driver.
|
PASSWORD_PROPERTY_KEY | final public static String PASSWORD_PROPERTY_KEY(Code) | | Key used to retreive the password value from the properties instance
passed to the driver.
|
PORT_NUMBER_INDEX | final public static int PORT_NUMBER_INDEX(Code) | | Index for port # coming out of parseHostPortPair().
|
PORT_PROPERTY_KEY | final public static String PORT_PROPERTY_KEY(Code) | | Key used to retreive the port number value from the properties instance
passed to the driver.
|
PROPERTIES_TRANSFORM_KEY | final public static String PROPERTIES_TRANSFORM_KEY(Code) | | |
TRACE | final public static boolean TRACE(Code) | | Should the driver generate method-call traces?
|
USER_PROPERTY_KEY | final public static String USER_PROPERTY_KEY(Code) | | Key used to retreive the username value from the properties instance
passed to the driver.
|
USE_CONFIG_PROPERTY_KEY | final public static String USE_CONFIG_PROPERTY_KEY(Code) | | |
NonRegisteringDriver | public NonRegisteringDriver() throws SQLException(Code) | | Construct a new driver and register it with DriverManager
throws: SQLException - if a database error occurs. |
acceptsURL | public boolean acceptsURL(String url) throws SQLException(Code) | | 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:
Parameters: url - the URL of the driver true if this driver accepts the given URL exception: SQLException - if a database-access error occurs See Also: java.sql.Driver.acceptsURL |
connect | public java.sql.Connection connect(String url, Properties info) throws SQLException(Code) | | 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 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
Parameters: url - the URL of the database to connect to Parameters: info - a list of arbitrary tag/value pairs as connection arguments a connection to the URL or null if it isnt us exception: SQLException - if a database access error occurs See Also: java.sql.Driver.connect |
database | public String database(Properties props)(Code) | | Returns the database property from props
Parameters: props - the Properties to look for the database property. the database name. |
getMajorVersion | public int getMajorVersion()(Code) | | Gets the drivers major version number
the drivers major version number |
getMajorVersionInternal | static int getMajorVersionInternal()(Code) | | Gets the drivers major version number
the drivers major version number |
getMinorVersion | public int getMinorVersion()(Code) | | Get the drivers minor version number
the drivers minor version number |
getMinorVersionInternal | static int getMinorVersionInternal()(Code) | | Get the drivers minor version number
the drivers minor version number |
getPropertyInfo | public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException(Code) | | 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
Parameters: url - the Url of the database to connect to Parameters: info - a proposed list of tag/value pairs that will be sent onconnect open. An array of DriverPropertyInfo objects describing possibleproperties. This array may be an empty array if no properties arerequired exception: SQLException - if a database-access error occurs See Also: java.sql.Driver.getPropertyInfo |
host | public String host(Properties props)(Code) | | Returns the hostname property
Parameters: props - the java.util.Properties instance to retrieve the hostnamefrom. the hostname |
jdbcCompliant | public boolean jdbcCompliant()(Code) | | 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
is this driver JDBC compliant? |
parseHostPortPair | protected static String[] parseHostPortPair(String hostPortPair) throws SQLException(Code) | | 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).
Parameters: hostPortPair - host and port in form of of [host][:port] array containing host and port as Strings throws: SQLException - if a parse error occurs |
port | public int port(Properties props)(Code) | | Returns the port number property
Parameters: props - the properties to get the port number from the port number |
property | public String property(String name, Properties props)(Code) | | Returns the given property from props
Parameters: name - the property name Parameters: props - the property instance to look in the property value, or null if not found. |
|
|
|