public class DbUtils
extends java.lang.Object
Constructor and Description |
---|
DbUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.sql.DataSource |
getDataSource(java.util.Properties props)
Get the JDBC
DataSource for the database. |
static void |
initDb(javax.sql.DataSource ds)
Initialize the sample's database.
|
static void |
purgeTables(javax.sql.DataSource ds)
Purge the sample's tables
|
public static javax.sql.DataSource getDataSource(java.util.Properties props) throws java.lang.Exception
DataSource
for the database.
The "db.name" property specifies the name of the database. Defaults to "JdbcConnectorSampleDb".
props
- configuration propertiesjava.lang.Exception
public static void initDb(javax.sql.DataSource ds) throws java.lang.Exception
Tables are created as needed and purged.
ds
- the DataSourcejava.lang.Exception
public static void purgeTables(javax.sql.DataSource ds) throws java.lang.Exception
ds
- the DataSourcejava.lang.Exception
Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902