All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.pics.DataBase

java.lang.Object
   |
   +----w3c.jigsaw.pics.DataBase

public class DataBase
extends Object
A very simple interface to query a database via JDBC.


Variable Index

 o DB_NAME_P
The property key relative to the name of the database.
 o DB_URL_P
The property key relative to the jdbc url of the database.
 o JDBC_DRIVER_P
The property key relative to the jdbc driver used to access the database.
 o PASSWD_P
The property key relative to the password of the user in the database.
 o USER_NAME_P
The property key relative to the user name.

Constructor Index

 o DataBase(Properties)
 o DataBase(String, String, String, String, String)

Method Index

 o closeConnection()
Stop the connection with the database.
 o connect()
Start the connection with the database.
 o getInt(String)
Get the integer value of a field.
 o getObject(String)
Get the Object value of a field.
 o getRealName()
Get the database real name.
 o getString(String)
Get the String value of a field.
 o insert(String)
Execute a SQL INSERT, UPDATE or DELETE request on the database.
 o next()
After a request execution, the current row is the first row of the result, this method makes the next row the current row.
 o request(String)
Execute an SQL request on the database that returns a result.

Variables

 o DB_NAME_P
 public static final String DB_NAME_P
The property key relative to the name of the database.

 o DB_URL_P
 public static final String DB_URL_P
The property key relative to the jdbc url of the database.

 o JDBC_DRIVER_P
 public static final String JDBC_DRIVER_P
The property key relative to the jdbc driver used to access the database.

 o USER_NAME_P
 public static final String USER_NAME_P
The property key relative to the user name.

 o PASSWD_P
 public static final String PASSWD_P
The property key relative to the password of the user in the database.

Constructors

 o DataBase
 public DataBase(Properties P)
Parameters:
P - the properties must be:

  • w3c.jigsaw.pics.DataBase.dbname : the database name
  • w3c.jigsaw.pics.DataBase.dburl : the jdbc database url
  • w3c.jigsaw.pics.DataBase.jdbcdriver : the jdbc driver
  • w3c.jigsaw.pics.DataBase.username : the user name
  • w3c.jigsaw.pics.DataBase.passwd : the password relative to the user name.
 o DataBase
 public DataBase(String name,
                 String dburl,
                 String driver,
                 String user,
                 String passwd)
Parameters:
name - the database name
dburl - the jdbc database url
driver - the jdbc driver
user - the user name
passwd - the password relative to the user name.

Methods

 o getRealName
 public String getRealName()
Get the database real name.

 o connect
 public boolean connect()
Start the connection with the database.

Returns:
True if the connection succed.
 o closeConnection
 public boolean closeConnection()
Stop the connection with the database.

Returns:
True if the connection stopped.
 o request
 public boolean request(String req)
Execute an SQL request on the database that returns a result.

Parameters:
req - The SQL request to execute.
Returns:
True if there's a result.
 o insert
 public boolean insert(String req)
Execute a SQL INSERT, UPDATE or DELETE request on the database.

Parameters:
req - The SQL request to execute.
Returns:
True if the request was executed correctly.
 o next
 public boolean next()
After a request execution, the current row is the first row of the result, this method makes the next row the current row.

Returns:
true if the new current row is valid; false if there are no more rows.
 o getString
 public String getString(String col)
Get the String value of a field.

Parameters:
col - The field's name.
Returns:
A String instance, being the field value.
 o getInt
 public int getInt(String col)
Get the integer value of a field.

Parameters:
col - The field's name.
Returns:
An integer, being the field value.
 o getObject
 public Object getObject(String col)
Get the Object value of a field.

Parameters:
col - The field's name.
Returns:
A Object instance, being the field value.

All Packages  Class Hierarchy  This Package  Previous  Next  Index