dsnserver
Class SQLDBcommunication

java.lang.Object
  extended by dsnserver.SQLDBcommunication

public class SQLDBcommunication
extends java.lang.Object

It is used for the communication with the MySQL Database.

Author:
kaltt

Field Summary
private static java.sql.Connection con
           
(package private)  java.lang.String mySqlDriver
           
(package private)  java.lang.String mySqlPasswd
           
(package private)  java.lang.String mySqlUrl
           
(package private)  java.lang.String mySqlUser
           
private static java.util.concurrent.Semaphore sem
           
private static java.sql.Statement stmt
           
 
Constructor Summary
SQLDBcommunication()
           
 
Method Summary
static void closeConnectionToDB()
          To close the connection to the DB
static void connectToDB()
          To open a connnection to a MySQL DB
static java.sql.ResultSet getResultsFromDB(java.lang.String query)
          To send a query to the DB.
static void lock()
           
static void makeTable()
           
static int sendQueryToDB(java.lang.String query)
          To send a query to the DB.
static void unlock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mySqlDriver

java.lang.String mySqlDriver

mySqlUrl

java.lang.String mySqlUrl

mySqlUser

java.lang.String mySqlUser

mySqlPasswd

java.lang.String mySqlPasswd

sem

private static java.util.concurrent.Semaphore sem

con

private static java.sql.Connection con

stmt

private static java.sql.Statement stmt
Constructor Detail

SQLDBcommunication

public SQLDBcommunication()
Method Detail

getResultsFromDB

public static java.sql.ResultSet getResultsFromDB(java.lang.String query)
To send a query to the DB.

Parameters:
String - query
Returns:
ResultSet rs

sendQueryToDB

public static int sendQueryToDB(java.lang.String query)
To send a query to the DB. For the Statemant DROP TABLE, CREATE TABLE and INSERT give back the number of affected rows.

Parameters:
String - query
Returns:
int count

connectToDB

public static void connectToDB()
                        throws java.lang.ClassNotFoundException,
                               java.sql.SQLException
To open a connnection to a MySQL DB

Throws:
java.lang.ClassNotFoundException
java.sql.SQLException

closeConnectionToDB

public static void closeConnectionToDB()
                                throws java.lang.ClassNotFoundException,
                                       java.sql.SQLException
To close the connection to the DB

Throws:
java.lang.ClassNotFoundException
java.sql.SQLException

lock

public static void lock()

unlock

public static void unlock()

makeTable

public static void makeTable()