Class com.imaginary.sql.msql.MsqlDriver
java.lang.Object
|
+--com.imaginary.sql.msql.MsqlDriver
- public class MsqlDriver
- extends java.lang.Object
- implements java.sql.Driver
The MsqlDriver class implements the JDBC Driver interface from the
JDBC specification. A Driver is specifically concerned with making
database connections via new JDBC Connection instances by responding
to URL requests.
Last modified $Date: 1999/07/06 05:56:03 $
- Version:
- $Revision: 1.6 $
- Author:
- George Reese (borg@imaginary.com)
Constructor Summary
|
MsqlDriver()
Constructs an MsqlDriver instance. |
Method Summary
|
boolean
|
acceptsURL(java.lang.String url)
Returns true if the driver thinks that it can open a connection
to the given URL. In this case, true is returned if and only if
the subprotocol is 'msql'. |
java.sql.Connection
|
connect(java.lang.String url,
java.util.Properties p)
Takes a look at the given URL to see if it is meant for this
driver. |
int
|
getMajorVersion()
Gives the major version for this driver as required by the JDBC
specification. |
int
|
getMinorVersion()
Gives the minor version for this driver as required by the JDBC
specification. |
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. |
boolean
|
jdbcCompliant()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
MsqlDriver
public MsqlDriver()
throws java.sql.SQLException
- Constructs an MsqlDriver instance. The JDBC specification requires
the driver then to register itself with the DriverManager.
- Throws:
- java.sql.SQLException - an error occurred in registering
acceptsURL
public boolean acceptsURL(java.lang.String url)
throws java.sql.SQLException
- Returns true if the driver thinks that it can open a connection
to the given URL. In this case, true is returned if and only if
the subprotocol is 'msql'.
- Specified by:
- acceptsURL(java.lang.String) in interface java.sql.Driver
- Parameters:
url
- The URL of the database.- Returns:
- True if this driver can connect to the given URL.
- Throws:
- java.sql.SQLException - never actually is thrown
connect
public java.sql.Connection connect(java.lang.String url,
java.util.Properties p)
throws java.sql.SQLException
- Takes a look at the given URL to see if it is meant for this
driver. If not, simply return null. If it is, then go ahead and
connect to the database. For the mSQL implementation of JDBC, it
looks for URL's in the form of
jdbc:msql://[host_addr]:[port]/[db_name]
- Specified by:
- connect(java.lang.String, java.util.Properties) in interface java.sql.Driver
- Parameters:
url
- the URL for the database in question
p
- the properties object- Returns:
- null if the URL should be ignored, a new Connection
implementation if the URL is a valid mSQL URL
- Throws:
- java.sql.SQLException - an error occurred during connection
such as a network error or bad URL
- See Also:
- connect
getMajorVersion
public int getMajorVersion()
- Gives the major version for this driver as required by the JDBC
specification.
- Specified by:
- getMajorVersion() in interface java.sql.Driver
- Returns:
- the major version
- See Also:
- getMajorVersion
getMinorVersion
public int getMinorVersion()
- Gives the minor version for this driver as required by the JDBC
specification.
- Specified by:
- getMinorVersion() in interface java.sql.Driver
- Returns:
- the minor version
- See Also:
- getMinorVersion
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 though
several calls to getPropertyInfo.
- Specified by:
- getPropertyInfo(java.lang.String, java.util.Properties) in interface java.sql.Driver
- Parameters:
url
- The URL of the database to connect to.
info
- A proposed list of tag/value pairs that will be sent on
connect open.- Returns:
- An array of DriverPropertyInfo objects describing possible
properties. This array may be an empty array if no properties
are required.
- Throws:
- java.sql.SQLException - never actually thrown
jdbcCompliant
public boolean jdbcCompliant()
- Description copied from interface:
- Specified by:
- jdbcCompliant() in interface java.sql.Driver
- Returns:
- information noting the fact that the mSQL database is not
SQL-92 and thus cannot support a JDBC compliant implementation.