|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.test.util.DBUtils
public class DBUtils
Utility code for getting a connection to a database. The most common method is getHSQLDBInMemoryDBConnection. This returns a connection to an in-memory HSQL database.
Field Summary | |
---|---|
java.sql.Connection |
conn
|
java.lang.String |
mDatabaseType
|
Constructor Summary | |
---|---|
DBUtils(java.util.Properties pProps)
Creates a new DBUtils given a Properties object containing connection info Expected keys: URL driver user password |
|
DBUtils(java.lang.String pURL,
java.lang.String pJDBCDriver,
java.lang.String pUser,
java.lang.String pPassword)
|
Method Summary | |
---|---|
java.io.File |
createFakeXADataSource(java.io.File pRoot)
|
java.io.File |
createFakeXADataSource(java.io.File pRoot,
java.lang.String pName)
|
static java.io.File |
createJTDataSource(java.io.File pRoot)
|
static java.io.File |
createJTDataSource(java.io.File pRoot,
java.lang.String pName,
java.lang.String pFakeXAName)
Creates a new JTDataSource component. |
void |
dump(java.sql.ResultSet rs)
|
void |
executeCreateIdGenerator()
|
void |
executeSQLFile(java.io.File pFile)
|
static java.util.Properties |
getDB2DBConnection(java.lang.String pHostName,
java.lang.String pPort,
java.lang.String pDBName,
java.lang.String pUser,
java.lang.String pPassword)
|
static java.util.Properties |
getHSQLDBFileDBConnection(java.lang.String pPath)
Returns a Properties object preconfigured to create an HSQLDB in memory database connecting with user "sa" password "" |
static java.util.Properties |
getHSQLDBInMemoryDBConnection()
Returns a Properties object preconfigured to create an HSQLDB in memory database connecting with user "sa" password "" |
static java.util.Properties |
getHSQLDBInMemoryDBConnection(java.lang.String pTestDBName)
Returns a Properties object preconfigured to create an HSQLDB in memory database connecting with user "sa" password "" |
static java.util.Properties |
getHSQLDBRegularDBConnection(java.lang.String pTestDBName,
java.lang.String pHostName,
java.lang.Object pUser,
java.lang.Object pPassword)
Returns a Properties object preconfigured to create an HSQLDB in memory database connecting with user "sa" password "" |
static java.util.Properties |
getMSSQLDBConnection(java.lang.String pHostName,
java.lang.String pPort,
java.lang.String pDBName,
java.lang.String pUser,
java.lang.String pPassword)
Returns connection properties for MSSQL |
static java.util.Properties |
getMySQLDBConnection(java.lang.String pHostName,
java.lang.String pPort,
java.lang.String pDBName,
java.lang.String pUser,
java.lang.String pPassword)
Returns connection properties for mysql |
static java.util.Properties |
getOracleDBConnection(java.lang.String pHostName,
java.lang.String pPort,
java.lang.String pDBName,
java.lang.String pUser,
java.lang.String pPassword)
Returns connection properties for MSSQL |
int |
getRowCount(java.lang.String pTable)
|
static java.util.Properties |
getSolidDBConnection(java.lang.String pHostName,
java.lang.String pPort,
java.lang.String pUser,
java.lang.String pPassword)
Returns connection properties for MSSQL |
static java.util.Properties |
getSybaseDBConnection(java.lang.String pHostName,
java.lang.String pPort,
java.lang.String pDBName,
java.lang.String pUser,
java.lang.String pPassword)
Returns connection properties for MSSQL |
boolean |
isDB2()
|
static boolean |
isDB2(java.util.Properties pProps)
|
boolean |
isMSSQLServer()
|
static boolean |
isMSSQLServer(java.util.Properties pProps)
|
boolean |
isOracle()
|
static boolean |
isOracle(java.util.Properties pProps)
|
boolean |
isSybase()
|
static boolean |
isSybase(java.util.Properties pProps)
|
void |
query(java.lang.String expression)
|
void |
shutdown()
|
void |
update(java.lang.String expression)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.sql.Connection conn
public java.lang.String mDatabaseType
Constructor Detail |
---|
public DBUtils(java.util.Properties pProps) throws java.lang.Exception
pProps
-
java.lang.Exception
public DBUtils(java.lang.String pURL, java.lang.String pJDBCDriver, java.lang.String pUser, java.lang.String pPassword) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public static java.util.Properties getHSQLDBInMemoryDBConnection(java.lang.String pTestDBName)
pTestDBName
- public static java.util.Properties getHSQLDBRegularDBConnection(java.lang.String pTestDBName, java.lang.String pHostName, java.lang.Object pUser, java.lang.Object pPassword)
pTestDBName
- public static java.util.Properties getHSQLDBFileDBConnection(java.lang.String pPath)
pTestDBName
- public static java.util.Properties getMSSQLDBConnection(java.lang.String pHostName, java.lang.String pPort, java.lang.String pDBName, java.lang.String pUser, java.lang.String pPassword)
pHostName
- host name of db serverpPort
- port number of dbpDBName
- database namepUser
- database usernamepPassword
- database user's password
public static java.util.Properties getMySQLDBConnection(java.lang.String pHostName, java.lang.String pPort, java.lang.String pDBName, java.lang.String pUser, java.lang.String pPassword)
pHostName
- host name of db serverpPort
- port number of dbpDBName
- database namepUser
- database usernamepPassword
- database user's password
public static java.util.Properties getDB2DBConnection(java.lang.String pHostName, java.lang.String pPort, java.lang.String pDBName, java.lang.String pUser, java.lang.String pPassword)
pString
- pString2
- pString3
- pString4
- pString5
-
public static java.util.Properties getOracleDBConnection(java.lang.String pHostName, java.lang.String pPort, java.lang.String pDBName, java.lang.String pUser, java.lang.String pPassword)
pHostName
- host name of db serverpPort
- port number of dbpDBName
- database namepUser
- database usernamepPassword
- database user's password
public static java.util.Properties getSolidDBConnection(java.lang.String pHostName, java.lang.String pPort, java.lang.String pUser, java.lang.String pPassword)
pHostName
- host name of db serverpPort
- port number of dbpDBName
- database namepUser
- database usernamepPassword
- database user's password
public static java.util.Properties getSybaseDBConnection(java.lang.String pHostName, java.lang.String pPort, java.lang.String pDBName, java.lang.String pUser, java.lang.String pPassword)
pHostName
- host name of db serverpPort
- port number of dbpDBName
- database namepUser
- database usernamepPassword
- database user's password
public static java.util.Properties getHSQLDBInMemoryDBConnection()
pTestDBName
- public void shutdown() throws java.sql.SQLException
java.sql.SQLException
public int getRowCount(java.lang.String pTable) throws java.sql.SQLException
java.sql.SQLException
public void query(java.lang.String expression) throws java.sql.SQLException
java.sql.SQLException
public void update(java.lang.String expression) throws java.sql.SQLException
java.sql.SQLException
public void dump(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
public void executeCreateIdGenerator() throws java.sql.SQLException
db
-
java.sql.SQLException
public void executeSQLFile(java.io.File pFile)
public java.io.File createFakeXADataSource(java.io.File pRoot) throws java.io.IOException
java.io.IOException
public java.io.File createFakeXADataSource(java.io.File pRoot, java.lang.String pName) throws java.io.IOException
java.io.IOException
public static java.io.File createJTDataSource(java.io.File pRoot) throws java.io.IOException
pRoot
-
java.io.IOException
public static java.io.File createJTDataSource(java.io.File pRoot, java.lang.String pName, java.lang.String pFakeXAName) throws java.io.IOException
pRoot
- pName
- pFakeXAName
-
java.io.IOException
public static boolean isOracle(java.util.Properties pProps)
pProps
-
public static boolean isSybase(java.util.Properties pProps)
pProps
-
public static boolean isMSSQLServer(java.util.Properties pProps)
pProps
-
public static boolean isDB2(java.util.Properties pProps)
pProps
-
public boolean isOracle()
pProps
-
public boolean isSybase()
pProps
-
public boolean isMSSQLServer()
pProps
-
public boolean isDB2()
pProps
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |