|
My Code:
protected String
// Borland JDataStore
driver = "com.borland.datastore.jdbc.DataStoreDriver",
db = "jdbc:borland:dsremote://localhost/db/agent.jds",
// postgreSQL
// driver = "org.postgresql.Driver",
// db = "jdbc:postgresql://localhost/pla",
// mySQL
// driver = "org.gjt.mm.mysql.Driver",
// db = "jdbc:mysql://localhost/pla",
user = "sa",
password = "sa";
protected Connection conn = null;
protected boolean updatable = false;
// constructor
public DBA() throws Exception {
Class.forName(this.driver).newInstance();
this.conn = DriverManager.getConnection(this.db, this.user, this.password);
// the way in J2EE, dbName must be register in the J2EE server.
// this.conn = ((DataSource) new InitialContext().lookup(dbName)).getConnection();
} |
|