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.
-
DB_NAME_P
- The property key relative to the name of the database.
-
DB_URL_P
- The property key relative to the jdbc url of the database.
-
JDBC_DRIVER_P
- The property key relative to the jdbc driver used to access the
database.
-
PASSWD_P
- The property key relative to the password of the user in the database.
-
USER_NAME_P
- The property key relative to the user name.
-
DataBase(Properties)
-
-
DataBase(String, String, String, String, String)
-
-
closeConnection()
- Stop the connection with the database.
-
connect()
- Start the connection with the database.
-
getInt(String)
- Get the integer value of a field.
-
getObject(String)
- Get the Object value of a field.
-
getRealName()
- Get the database real name.
-
getString(String)
- Get the String value of a field.
-
insert(String)
- Execute a SQL INSERT, UPDATE or DELETE request on the database.
-
next()
- After a request execution, the current row is the first
row of the result, this method makes the next row the current row.
-
request(String)
- Execute an SQL request on the database that returns a result.
DB_NAME_P
public static final String DB_NAME_P
- The property key relative to the name of the database.
DB_URL_P
public static final String DB_URL_P
- The property key relative to the jdbc url of the database.
JDBC_DRIVER_P
public static final String JDBC_DRIVER_P
- The property key relative to the jdbc driver used to access the
database.
USER_NAME_P
public static final String USER_NAME_P
- The property key relative to the user name.
PASSWD_P
public static final String PASSWD_P
- The property key relative to the password of the user in the database.
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.
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.
getRealName
public String getRealName()
- Get the database real name.
connect
public boolean connect()
- Start the connection with the database.
- Returns:
- True if the connection succed.
closeConnection
public boolean closeConnection()
- Stop the connection with the database.
- Returns:
- True if the connection stopped.
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.
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.
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.
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.
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.
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