Class DatabaseManager

java.lang.Object
  extended byDatabaseManager

public class DatabaseManager
extends java.lang.Object

Class that handles the connection with the database


Constructor Summary
DatabaseManager(java.lang.String driver, java.lang.String url)
          Constructor that takes the driver name and url
 
Method Summary
 java.util.List getListForQuery(java.lang.String query)
          Method to execute a query and return a list of strings for the first returned row
 java.lang.String getStringForQuery(java.lang.String query)
          Method to execute a query and return a string of the first result
static void main(java.lang.String[] args)
           
 void testConnection()
          Method for testing the connection
 void testQuery(java.lang.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(java.lang.String driver,
                       java.lang.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(java.lang.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 java.lang.String getStringForQuery(java.lang.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 java.util.List getListForQuery(java.lang.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(java.lang.String[] args)