de.cesr.more.util
Class MMySqlService

java.lang.Object
  extended by de.cesr.more.util.MMySqlService

public class MMySqlService
extends Object

MORe Provides means to connect to the DB defined in parameters of MSqlPa and disconnect.

Date:
11.02.2014

Field Summary
protected static MMySqlService instance
          The instance of this class
 
Method Summary
static ResultSet connect(String sql)
          Execute the given SQL statement and return the according ResultSet
static void disconnect()
          Disconnect the current mySQL connection
protected static Connection getConnection()
          Returns the current connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static MMySqlService instance
The instance of this class

Method Detail

getConnection

protected static Connection getConnection()
                                   throws InstantiationException,
                                          IllegalAccessException,
                                          ClassNotFoundException,
                                          SQLException
Returns the current connection. If not existing, it tries to establish a JDBC Connection to the MySQL database given the settings provided to the constructor.

Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
SQLException

connect

public static ResultSet connect(String sql)
                         throws SQLException,
                                InstantiationException,
                                IllegalAccessException,
                                ClassNotFoundException
Execute the given SQL statement and return the according ResultSet

Parameters:
sql - the statement to query
Returns:
the ResultSet
Throws:
ClassNotFoundException
IllegalAccessException
InstantiationException
SQLException

disconnect

public static void disconnect()
Disconnect the current mySQL connection