sg.edu.nus.util
Class DBConnector

java.lang.Object
  extended by sg.edu.nus.util.DBConnector

public abstract class DBConnector
extends java.lang.Object

This class is used for providing the default information in order to connect to the back-end database.

Version:
1.0 2006-1-27
Author:
Xu Linhao

Constructor Summary
DBConnector()
           
 
Method Summary
static java.sql.ResultSet executeQuery(java.sql.Connection conn, java.lang.String selectSQL)
           
static java.util.Vector<java.lang.String> getColumnNames(java.sql.ResultSet rs)
           
static java.sql.Connection getConnection()
          Build connection with the back-end database with the default information.
static java.sql.Connection getConnection(java.lang.String DSN, java.lang.String USER, java.lang.String PWD)
           
static java.util.Vector<java.util.Vector<java.lang.String>> getDataFromResultSet(java.sql.ResultSet rs)
           
static void main(java.lang.String[] args)
          Just for testing above code
static void printRS(java.sql.ResultSet rs)
           
static void registerDriver()
          Initiate the MySQL driver to be prepared for building connection with the database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConnector

public DBConnector()
Method Detail

registerDriver

public static void registerDriver()
Initiate the MySQL driver to be prepared for building connection with the database.


getConnection

public static java.sql.Connection getConnection()
Build connection with the back-end database with the default information.

Returns:
the Connection with a specified database

getConnection

public static java.sql.Connection getConnection(java.lang.String DSN,
                                                java.lang.String USER,
                                                java.lang.String PWD)

executeQuery

public static java.sql.ResultSet executeQuery(java.sql.Connection conn,
                                              java.lang.String selectSQL)

getDataFromResultSet

public static java.util.Vector<java.util.Vector<java.lang.String>> getDataFromResultSet(java.sql.ResultSet rs)

getColumnNames

public static java.util.Vector<java.lang.String> getColumnNames(java.sql.ResultSet rs)

printRS

public static void printRS(java.sql.ResultSet rs)

main

public static void main(java.lang.String[] args)
Just for testing above code