|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DatabaseConnection
This interface defines a database connection. It needs to load drivers and provide properties and and functionality for the specific database type. further more it has to hald connection properties. derive this class if your wish to implement your own Database type. this interface is needed because databases differ extremely from each other.
DatabaseConnectionTemplate
Method Summary | |
---|---|
boolean |
beforeConnect()
this hook is called before connect. use to ask for passwords or whatever. |
void |
configure(java.awt.Window owner)
give the user the possibility to configure this connection. this should usually show a configuration dialog |
java.lang.Object |
doAssignmentFixing(java.lang.Class target,
java.lang.Object obj)
Most drivers return strange values. |
java.util.Properties |
getConnectionProperties()
get property list for connection. |
java.lang.String |
getConnectionString()
get connection string |
java.lang.String |
getDescription()
get description of this connection |
java.awt.image.BufferedImage |
getImage()
get connection image |
java.lang.String |
getName()
get the name of this connection |
java.util.Map<java.lang.String,java.lang.String> |
getSpecialCommands()
get a list of special commands for this databse types possible keys: autoincrement -> keyword(s) for auto increment respectively identity columns createtable -> "create table if not exists" string. replaces %%tname%% with table name and %%vars%% with column values droptable -> drop table command. |
java.util.Map<java.lang.String,java.lang.String> |
getTableColumns(java.sql.Statement st,
java.lang.String tname)
get a map of table columns mapped to their types for given table |
java.util.List<java.lang.String> |
getTables(java.sql.Statement st)
get a list of all tables in this databse |
java.util.Map<java.lang.String,java.lang.String> |
getTypeMapping()
The type mapping is to map java types to database specific types that can be used in create table statement java type is identified my Class.getName() |
boolean |
handleCreateTableException(java.sql.SQLException e)
handle an exception that was thrown due create table command |
boolean |
loadDriver()
load the database driver if necessary |
void |
onClose()
hook which is called right after connection was closed |
boolean |
onConnected(java.sql.Connection con)
called right after successful connection. |
void |
recover(java.util.Map<java.lang.String,java.lang.String> data)
recover connection properties which where obtained form PreferenceStorage |
java.util.Map<java.lang.String,java.lang.String> |
save()
return a list of connection properties that can be saved in PreferenceStorage |
boolean |
supportsAutoGeneratedKeys()
return true if your database type supports automatically generated keys. |
Method Detail |
---|
boolean loadDriver()
java.lang.String getConnectionString()
DriverManager.getConnection(String, Properties)
java.util.Properties getConnectionProperties()
DriverManager.getConnection(String, Properties)
java.lang.String getName()
java.lang.String getDescription()
java.awt.image.BufferedImage getImage()
void configure(java.awt.Window owner)
owner
- owning windowjava.util.Map<java.lang.String,java.lang.String> getTypeMapping()
Class.getName()
java.util.Map<java.lang.String,java.lang.String> save()
PreferenceStorage
void recover(java.util.Map<java.lang.String,java.lang.String> data)
PreferenceStorage
data
- recovered propertiesboolean beforeConnect()
boolean onConnected(java.sql.Connection con)
con
- connection which was established
void onClose()
java.util.Map<java.lang.String,java.lang.String> getSpecialCommands()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |