org.problets.lib.comm.database
Class CommunicateDatabase

java.lang.Object
  extended by org.problets.lib.comm.database.CommunicateDatabase

public class CommunicateDatabase
extends java.lang.Object

Lower class used to connect to database

Author:
Atanas Frengov

Constructor Summary
CommunicateDatabase(java.lang.String host, java.lang.String database, java.lang.String username, java.lang.String password)
          constructor that connects to a database specified by the parameters
 
Method Summary
 boolean connect(java.lang.String host, java.lang.String database, java.lang.String username, java.lang.String password)
          Connect to the database based on the specified parameters
 void disconnect()
          Disconnect from the database
 boolean isConnected()
          Check if the client is still connected to the database
static void main(java.lang.String[] args)
           
 int update(java.lang.String statementString)
          executes the statement string to update the database and returns the number of records were updated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommunicateDatabase

public CommunicateDatabase(java.lang.String host,
                           java.lang.String database,
                           java.lang.String username,
                           java.lang.String password)
constructor that connects to a database specified by the parameters

Parameters:
host - the host of the connection. current is acharya.phobos.ramapo.edu
database - the database to be used
username - the username to be used
password - the password for the user to be used for the connection
Method Detail

isConnected

public boolean isConnected()
Check if the client is still connected to the database

Returns:
true if still connected, false if disconnected

connect

public boolean connect(java.lang.String host,
                       java.lang.String database,
                       java.lang.String username,
                       java.lang.String password)
Connect to the database based on the specified parameters

Parameters:
host - the host to be used
database - the database to be used
username - the username to be used for logging to the database
password - the password corresponding to the specified username
Returns:
true if the connection was succesful, false if the was an exception

disconnect

public void disconnect()
Disconnect from the database


update

public int update(java.lang.String statementString)
executes the statement string to update the database and returns the number of records were updated

Returns:
an integer representing the number of rows affected

main

public static void main(java.lang.String[] args)