|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.sql.SqlDatabase
public class SqlDatabase
Description and configuration for a database connection - driver, URL, user, password, etc. Mostly designed to simplify the task of creating those horrible JDBC URLs.
There are three major varieties of configuration. For file-based databases like Microsoft Access and HSQLDB, use this format:
config = new SqlDatabase();
config.setType("Access");
config.setPath("c:/path/to/mydata.mdb");
For server-based databases like Microsoft SQL Server and MySQL, use this
format:
config = new SqlDatabase();
config.setType("MySQL");
config.setServer("192.168.1.1");
config.setName("partner");
config.setUser("paul");
config.setPassword("secretmagicword");
Finally, if it's a nonstandard (for Partner) database, or if you can't get
the config to work correctly using individual properties, you can specify
just a JDBC driver and JDBC URL. Note that if you do so, it completely
overrides and ignores all other settings except for the username and
password.
config = new SqlDatabase();
config.setType("other");
config.setDriver("org.bar.foo.jdbc.WeirdDriver");
config.setJdbcUrl("jdbc:weirdodb://192.168.1.1/something");
config.setUser("plokta");
config.setPassword("ultrasecret");
Copyright 2000-2008 Partner Software, Inc. All rights reserved.
| Constructor Summary | |
|---|---|
SqlDatabase()
Create a new DatabaseConnectionConfig. |
|
SqlDatabase(Cog state)
|
|
| Method Summary | |
|---|---|
java.lang.String |
getDatabase()
Database name for extraction (optional). |
java.lang.String |
getDriver()
Database JDBC Driver classname. |
java.lang.String |
getPassword()
Database password for extraction (optional). |
java.lang.String |
getPath()
Database path for extraction (optional). |
java.lang.String |
getProperties()
Database properties for extraction (optional). |
java.lang.String |
getServer()
Database server for extraction (optional). |
java.lang.String |
getType()
Database type for extraction (optional). |
java.lang.String |
getUrl()
Database JDBC URL. |
java.lang.String |
getUser()
Database user for extraction (optional). |
SqlConnection |
openConnection()
Creates and opens an SqlConnection for this database. |
void |
setDatabase(java.lang.String newDatabaseName)
|
void |
setDriver(java.lang.String newDriver)
|
void |
setPassword(java.lang.String newDatabasePassword)
|
void |
setPath(Path newDatabasePath)
|
void |
setPath(java.lang.String newDatabasePath)
|
void |
setProperties(java.lang.String newDatabaseProperties)
|
void |
setServer(java.lang.String newDatabaseServer)
|
void |
setType(java.lang.String newDatabaseType)
|
void |
setUrl(java.lang.String newUrl)
|
void |
setUser(java.lang.String newDatabaseUser)
|
Cog |
toCog()
Returns the complete internal state of this object in the form of a Cog. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SqlDatabase()
public SqlDatabase(Cog state)
| Method Detail |
|---|
public Cog toCog()
CoggableCog.
toCog in interface Coggable
public SqlConnection openConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getPassword()
public void setPassword(java.lang.String newDatabasePassword)
public java.lang.String getUser()
public void setUser(java.lang.String newDatabaseUser)
public java.lang.String getServer()
public void setServer(java.lang.String newDatabaseServer)
public java.lang.String getType()
public void setType(java.lang.String newDatabaseType)
public java.lang.String getDatabase()
public void setDatabase(java.lang.String newDatabaseName)
public java.lang.String getPath()
public void setPath(java.lang.String newDatabasePath)
public void setPath(Path newDatabasePath)
public java.lang.String getProperties()
public void setProperties(java.lang.String newDatabaseProperties)
public java.lang.String getUrl()
public void setUrl(java.lang.String newUrl)
public java.lang.String getDriver()
public void setDriver(java.lang.String newDriver)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||