IDataManager
interface@Deprecated public class DataManager extends Object
Here is an example of opening a connection to a sql datasource:
String dataSource = "dataSourceName"; ISqlWorker worker = null; try { // get the connection information for the datasource ConnectionInfo conninfo = ConnectionManager.getConnInfo(dataSource); // get a worker instance from the data manager worker = DataManager.createWorker(dataSource); // TODO use one of the execute methods from the worker to // perform the query or update } catch (SQLException e) { // log and report the exception Debug.fatal(e, m_logCategory); throw new PortalException(e); } finally { if (worker != null) { // release the worker so the sql resources can be reclaimed worker.release(); } }
ISqlWorker
,
ConnectionManager
Modifier and Type | Field and Description |
---|---|
static String |
DATA_SERVICE
Deprecated.
|
static String |
DATA_SERVICE_ALIAS_PREFIX
Deprecated.
|
static String |
DATA_SERVICE_FOLDER
Deprecated.
|
Constructor and Description |
---|
DataManager()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static void |
beginTran()
Deprecated.
Starts sql transaction for default database connection on the current
thread.
|
static void |
commitTran()
Deprecated.
Commits any outstanding transaction on the current thread.
|
static ISqlWorker |
createSafeWorker(String datasourceName)
Deprecated.
Get worker object to perform some database work.
|
static ISqlWorker |
createWorker()
Deprecated.
Get worker object to perform some database work for the default portal
datasource.
|
static ISqlWorker |
createWorker(String datasourceName)
Deprecated.
Get worker object to perform some database work
|
static void |
executeSqlScriptFile(String fileName)
Deprecated.
|
static void |
executeSqlScriptFile(String fileName,
PrintStream terminalWriter,
PrintStream spoolWriter,
boolean ignoreErrors,
Map<String,String> args)
Deprecated.
|
static void |
executeSqlScriptString(String script,
String datasource)
Deprecated.
Execute Sql script file against default DSN
|
static void |
executeSqlScriptString(String script,
String datasource,
boolean ignoreErrors,
Map<String,String> args)
Deprecated.
Execute Sql script file against default DSN
|
static Connection |
getConnection()
Deprecated.
Returns connection to a default database
|
static Connection |
getConnection(String datasource)
Deprecated.
Returns connection to a specific datasource
|
static IDatabaseRuntime |
getDatabaseRuntime()
Deprecated.
Returns current database runtime which is setup for active portal
database connection
|
static int |
getDefaultServerType()
Deprecated.
Returns name of the default database server type: mssql, oracle, mysql
|
static void |
release()
Deprecated.
Release all connection resources
|
static void |
releaseConnection(Connection conn)
Deprecated.
Releases connection back to the pool
|
static void |
rollbackTran()
Deprecated.
Rollsback any outstanding transaction on the current thread.
|
public static final String DATA_SERVICE
public static final String DATA_SERVICE_FOLDER
public static final String DATA_SERVICE_ALIAS_PREFIX
public static int getDefaultServerType()
ISqlWorker.SERVERTYPE_ORACLE
for oracle or
ISqlWorker.SERVERTYPE_MSSQL
otherwisepublic static ISqlWorker createWorker() throws SQLException
SQLException
public static void beginTran() throws SQLException
ISqlWorker.beginTran()
method.SQLException
public static void commitTran() throws SQLException
ISqlWorker.commitTran()
methodSQLException
public static void rollbackTran() throws SQLException
ISqlWorker.rollbackTran()
methodSQLException
public static ISqlWorker createWorker(String datasourceName) throws SQLException
datasourceName
- name of the datasource to create a worker forSQLException
public static ISqlWorker createSafeWorker(String datasourceName) throws SQLException
datasourceName
- name of the datasource to useSQLException
public static IDatabaseRuntime getDatabaseRuntime()
public static Connection getConnection()
public static Connection getConnection(String datasource)
datasource
- name of the datasourcepublic static void release()
public static void releaseConnection(Connection conn)
public static void executeSqlScriptFile(String fileName) throws SQLException, ServerBusyException, DeadlockException
public static void executeSqlScriptFile(String fileName, PrintStream terminalWriter, PrintStream spoolWriter, boolean ignoreErrors, Map<String,String> args) throws SQLException, ServerBusyException, DeadlockException
public static void executeSqlScriptString(String script, String datasource) throws SQLException, ServerBusyException, DeadlockException
public static void executeSqlScriptString(String script, String datasource, boolean ignoreErrors, Map<String,String> args) throws SQLException, ServerBusyException, DeadlockException