|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.sahits.phpclassgenerator.DBConnection
public abstract class DBConnection
This abstract class handles the connection to the DB. It queries the DB for the structure of a table. Supported DBs are
| Field Summary | |
|---|---|
protected java.sql.Connection |
conn
Connection to the DB |
protected java.lang.String |
db
DB on the server |
protected java.lang.String |
host
Host name of the server where the DB is hosted |
protected java.lang.String |
password
Password for the User |
protected java.lang.String |
product
What DB are we talking about MySQL, Oracle, MSSQL, PostgSQL, ... |
protected java.lang.String |
table
Table to query |
protected java.lang.String |
user
User to query the DB |
| Constructor Summary | |
|---|---|
protected |
DBConnection(java.lang.String product,
java.lang.String hostname,
java.lang.String uname,
java.lang.String pwd,
java.lang.String database,
java.lang.String tablename)
Constructor initializes the connection data |
| Method Summary | |
|---|---|
protected abstract DBStructure |
getStructure()
Generates a DBStructure Object for the table. |
protected abstract void |
loadDriver()
check if the driver is available |
void |
setHost(java.lang.String host)
|
void |
setPassword(java.lang.String password)
|
void |
setProduct(java.lang.String product)
|
void |
setTable(java.lang.String table)
|
void |
setUser(java.lang.String user)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.sql.Connection conn
protected java.lang.String host
protected java.lang.String product
protected java.lang.String user
protected java.lang.String password
protected java.lang.String table
protected java.lang.String db
| Constructor Detail |
|---|
protected DBConnection(java.lang.String product,
java.lang.String hostname,
java.lang.String uname,
java.lang.String pwd,
java.lang.String database,
java.lang.String tablename)
throws java.sql.SQLException
product - what kind of DB (MySQL, PostgeSQL, Oracle, Derby, MS SQL Server, ...)hostname - of the db eg. localhostuname - user name to connect to the DBpwd - password of the userdatabase - or schema of the tabletablename - table name
java.sql.SQLException - Connecting failed probably due to incorrect input| Method Detail |
|---|
protected abstract void loadDriver()
public void setHost(java.lang.String host)
host - the host to sethostpublic void setProduct(java.lang.String product)
product - the product to setproductpublic void setUser(java.lang.String user)
user - the user to setuserpublic void setPassword(java.lang.String password)
password - the password to setpasswordpublic void setTable(java.lang.String table)
table - the table to settable
protected abstract DBStructure getStructure()
throws java.sql.SQLException
DBStructure
java.sql.SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||