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
- on failurepublic static void initDb(javax.sql.DataSource ds) throws java.lang.Exception
Tables are created as needed and purged.
ds
- the DataSourcejava.lang.Exception
- on failurepublic static void purgeTables(javax.sql.DataSource ds) throws java.lang.Exception
ds
- the DataSourcejava.lang.Exception
- on failureCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641