Class DatabaseManager

java.lang.Object
  extended by DatabaseManager

public class DatabaseManager
extends Object

Class that handles the connection with the database


Constructor Summary
DatabaseManager(String driver, String url)
          Constructor that takes the driver name and url
 
Method Summary
 List getListForQuery(String query)
          Method to execute a query and return a list of strings for the first returned row
 String getStringForQuery(String query)
          Method to execute a query and return a string of the first result
static void main(String[] args)
           
 void testConnection()
          Method for testing the connection
 void testQuery(String query, int numCols)
          Method to test a query and print the results
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseManager

public DatabaseManager(String driver,
                       String url)
Constructor that takes the driver name and url

Parameters:
driver - the class that communicates with the database
url - the url of the database as a string
Method Detail

testConnection

public void testConnection()
Method for testing the connection


testQuery

public void testQuery(String query,
                      int numCols)
Method to test a query and print the results

Parameters:
query - the query to execute
numCols - the number of columns in the result

getStringForQuery

public String getStringForQuery(String query)
Method to execute a query and return a string of the first result

Parameters:
query - the query to execute
Returns:
the first result of the query, or null if none

getListForQuery

public List getListForQuery(String query)
Method to execute a query and return a list of strings for the first returned row

Parameters:
query - the query to execute
Returns:
list of strings for the data in the first returned row, the list may be empty

main

public static void main(String[] args)