com.isti.util.database
Class MySQLConnectionJDBC

java.lang.Object
  extended by com.isti.util.database.ConnectionJDBC
      extended by com.isti.util.database.MySQLConnectionJDBC

public class MySQLConnectionJDBC
extends ConnectionJDBC


Field Summary
protected static java.lang.String MYSQL_DRIVER_NAME
           
 
Fields inherited from class com.isti.util.database.ConnectionJDBC
DEFAULT_DRIVER_NAME, DEFAULT_PROTOCOL, DEFAULT_SUBNAME, DEFAULT_SUBPROTOCOL, DIALOG_OPTION_STR, INFO_PASSWORD_KEY, INFO_USER_KEY
 
Constructor Summary
MySQLConnectionJDBC(java.lang.String url, java.util.Properties info, CallBackCompletion callBack)
          Connect to a MySQL JDBC database.
MySQLConnectionJDBC(java.lang.String hostName, java.lang.String[] failOverHostNames, java.lang.String port, java.lang.String dataBase, java.lang.String userName, java.lang.String passWord, CallBackCompletion callBack)
          Connect to an MySQL JDBC database.
 
Method Summary
static void deregisterDriver()
          Drops the MySQL driver from the DriverManager's list.
static java.lang.String getUrl(java.lang.String hostName, java.lang.String[] failOverHostNames, java.lang.String port, java.lang.String dataBase)
          Gets a database url.
static void registerDriver()
          Registers the MySQL driver with the DriverManager.
 
Methods inherited from class com.isti.util.database.ConnectionJDBC
close, createConnection, createPasswordDialog, createPasswordPanel, createStatement, deregisterDriver, executeQuery, executeQuery, executeQueryNow, getConnection, getInfo, getStatement, getURL, getURL, initConnection, isClosed, processCallback, promptForPassword, registerDriver, saveUserPassword, setConnection, setStatement, setUserPassword, startBackgroundThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MYSQL_DRIVER_NAME

protected static final java.lang.String MYSQL_DRIVER_NAME
See Also:
Constant Field Values
Constructor Detail

MySQLConnectionJDBC

public MySQLConnectionJDBC(java.lang.String hostName,
                           java.lang.String[] failOverHostNames,
                           java.lang.String port,
                           java.lang.String dataBase,
                           java.lang.String userName,
                           java.lang.String passWord,
                           CallBackCompletion callBack)
                    throws java.lang.ClassNotFoundException,
                           java.lang.InstantiationException,
                           java.lang.IllegalAccessException,
                           java.sql.SQLException
Connect to an MySQL JDBC database.

Parameters:
hostName - the host name.
failOverHostNames - the fail over host names or null for none.
port - the port.
dataBase - the database.
userName - the user name.
passWord - password for the above user name
callBack - callBack method or null to execute on current thread
Throws:
java.lang.ClassNotFoundException - if the driver's class could not be found.
java.lang.InstantiationException - if the driver could not be instantiated.
java.lang.IllegalAccessException - if the driver's class or initializer is not accessible.
java.sql.SQLException - if a database access error occurs.

MySQLConnectionJDBC

public MySQLConnectionJDBC(java.lang.String url,
                           java.util.Properties info,
                           CallBackCompletion callBack)
Connect to a MySQL JDBC database.

Parameters:
url - a database url of the form jdbc:subprotocol:subname
info - properties information
callBack - callBack method or null to execute on current thread
Throws:
java.lang.ClassNotFoundException - if the driver's class could not be found.
java.lang.InstantiationException - if the driver could not be instantiated.
java.lang.IllegalAccessException - if the driver's class or initializer is not accessible.
java.sql.SQLException - if a database access error occurs.
See Also:
getUrl
Method Detail

registerDriver

public static void registerDriver()
                           throws java.lang.ClassNotFoundException,
                                  java.lang.InstantiationException,
                                  java.lang.IllegalAccessException,
                                  java.sql.SQLException
Registers the MySQL driver with the DriverManager. A newly-loaded driver class should call the method registerDriver to make itself known to the DriverManager.

Throws:
java.lang.ClassNotFoundException - if the driver's class could not be found.
java.lang.InstantiationException - if the driver could not be instantiated.
java.lang.IllegalAccessException - if the driver's class or initializer is not accessible.
java.sql.SQLException - if a database access error occurs.

deregisterDriver

public static void deregisterDriver()
                             throws java.lang.ClassNotFoundException,
                                    java.lang.InstantiationException,
                                    java.lang.IllegalAccessException,
                                    java.sql.SQLException
Drops the MySQL driver from the DriverManager's list. Applets can only deregister Drivers from their own classloaders.

Throws:
java.lang.ClassNotFoundException - if the driver's class could not be found.
java.lang.InstantiationException - if the driver could not be instantiated.
java.lang.IllegalAccessException - if the driver's class or initializer is not accessible.
java.sql.SQLException - if a database access error occurs.

getUrl

public static java.lang.String getUrl(java.lang.String hostName,
                                      java.lang.String[] failOverHostNames,
                                      java.lang.String port,
                                      java.lang.String dataBase)
Gets a database url.

Parameters:
hostName - the host name.
failOverHostNames - the fail over host names or null for none.
port - the port.
dataBase - the database.
Returns:
the database url.