org.jminor.common.db.dbms
Class MySQLDatabase

java.lang.Object
  extended by org.jminor.common.db.AbstractDatabase
      extended by org.jminor.common.db.dbms.MySQLDatabase
All Implemented Interfaces:
Database

public final class MySQLDatabase
extends AbstractDatabase

A Database implementation based on the MySQL database.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jminor.common.db.Database
Database.Statistics
 
Field Summary
 
Fields inherited from interface org.jminor.common.db.Database
DATABASE_EMBEDDED, DATABASE_HOST, DATABASE_IMPLEMENTATION_CLASS, DATABASE_POOL_STATISTICS, DATABASE_PORT, DATABASE_SID, DATABASE_TYPE, DEFAULT_LOGIN_TIMEOUT, DERBY, H2, HSQL, MYSQL, ORACLE, PASSWORD_PROPERTY, POSTGRESQL, SQLSERVER, USER_PROPERTY
 
Constructor Summary
MySQLDatabase()
          Instantiates a new MySQLDatabase.
MySQLDatabase(String host, String port, String dbname)
          Instantiates a new MySQLDatabase.
 
Method Summary
 String getAutoIncrementValueSQL(String idSource)
          Returns a query string for retrieving the last automatically generated id from the given id source
 String getURL(Properties connectionProperties)
          
 void loadDriver()
          Loads the database driver
 boolean supportsNowait()
          Returns true if the dbms supports the select for update NOWAIT option
 
Methods inherited from class org.jminor.common.db.AbstractDatabase
addConnectionProperties, createConnection, getAuthenticationInfo, getCheckConnectionQuery, getDatabaseType, getErrorMessage, getHost, getLoginTimeout, getPort, getSequenceSQL, getSid, isEmbedded, shutdownEmbedded, supportsIsValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySQLDatabase

public MySQLDatabase()
Instantiates a new MySQLDatabase.


MySQLDatabase

public MySQLDatabase(String host,
                     String port,
                     String dbname)
Instantiates a new MySQLDatabase.

Parameters:
host - the host name
port - the port number
dbname - the db name
Method Detail

loadDriver

public void loadDriver()
                throws ClassNotFoundException
Loads the database driver

Throws:
ClassNotFoundException - in case the driver class in not found

getAutoIncrementValueSQL

public String getAutoIncrementValueSQL(String idSource)
Returns a query string for retrieving the last automatically generated id from the given id source

Parameters:
idSource - the source for the id, for example a sequence name or in the case of Derby, the name of the table
Returns:
a query string for retrieving the last auto-increment value from idSource

getURL

public String getURL(Properties connectionProperties)

Parameters:
connectionProperties - the connection properties, used primarily to provide embedded databases with user info for authentication purposes
Returns:
the database url of the active database, based on system properties

supportsNowait

public boolean supportsNowait()
Returns true if the dbms supports the select for update NOWAIT option

Specified by:
supportsNowait in interface Database
Overrides:
supportsNowait in class AbstractDatabase
Returns:
true if NOWAIT is supported for select for update