Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class org.gjt.mm.mysql.Driver

java.lang.Object
  |
  +--org.gjt.mm.mysql.Driver

public class Driver
extends java.lang.Object
implements java.sql.Driver

Constructor Summary
Driver()
          Construct a new driver and register it with DriverManager
 
Method Summary
boolean acceptsURL(java.lang.String Url)
          Returns true if the driver thinks it can open a connection to the given 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. 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.
java.lang.String database()
           
int getMajorVersion()
          Gets the drivers major version number
int getMinorVersion()
          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()
           
boolean jdbcCompliant()
          Report whether the driver is a genuine JDBC compliant driver.
int port()
           
java.lang.String property(java.lang.String Name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

Driver

public Driver()
       throws java.sql.SQLException
Construct a new driver and register it with DriverManager
Throws:
java.sql.SQLException -  
Method Detail

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 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:
connect(java.lang.String, java.util.Properties) in interface java.sql.Driver
Parameters:
url - the URL of the database to connect to
info - a list of arbitrary tag/value pairs as connection arguments
Returns:
a connection to the URL or null if it isnt us
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
connect

acceptsURL

public boolean acceptsURL(java.lang.String Url)
                  throws java.sql.SQLException
Returns true if the driver thinks it can open a connection to the given URL. 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:
acceptsURL(java.lang.String) in interface java.sql.Driver
Parameters:
url - the URL of the driver
Returns:
true if this driver accepts the given URL
Throws:
java.sql.SQLException - if a database-access error occurs
See Also:
acceptsURL

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:
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 - if a database-access error occurs
See Also:
getPropertyInfo

getMajorVersion

public int getMajorVersion()
Gets the drivers major version number
Specified by:
getMajorVersion() in interface java.sql.Driver
Returns:
the drivers major version number

getMinorVersion

public int getMinorVersion()
Get the drivers minor version number
Specified by:
getMinorVersion() in interface java.sql.Driver
Returns:
the drivers minor version number

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:
jdbcCompliant() in interface java.sql.Driver

host

public java.lang.String host()

port

public int port()

database

public java.lang.String database()

property

public java.lang.String property(java.lang.String Name)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD