Package org.apache.manifoldcf.jdbc
Class JDBCConnection
- java.lang.Object
-
- org.apache.manifoldcf.jdbc.JDBCConnection
-
public class JDBCConnection extends java.lang.Object
This object describes a connection to a particular JDBC instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
JDBCConnection.ExecuteOperationThread
protected class
JDBCConnection.JDBCPSResultSet
protected class
JDBCConnection.JDBCResultSet
protected static class
JDBCConnection.NextResultRowThread
protected class
JDBCConnection.PreparedStatementQueryThread
protected static class
JDBCConnection.RDynamicRow
Dynamic result row implementationprotected class
JDBCConnection.StatementQueryThread
protected class
JDBCConnection.TestConnectionThread
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
_rcsid
protected java.lang.String
driverString
protected java.lang.String
jdbcProvider
protected java.lang.String
password
protected boolean
useName
protected java.lang.String
userName
-
Constructor Summary
Constructors Constructor Description JDBCConnection(java.lang.String jdbcProvider, boolean useName, java.lang.String host, java.lang.String databaseName, java.lang.String rawDriverString, java.lang.String userName, java.lang.String password)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static void
cleanupDatabaseObject(java.lang.Object x)
Call this method on every parameter or result object, when we're done with it, if it's possible that the object is a BLOB or CLOB.protected static void
cleanupParameters(java.util.ArrayList data)
Clean up parameters after query has been triggered.protected static void
closePS(java.sql.PreparedStatement ps)
protected static void
closeResultset(java.sql.ResultSet rs)
protected static void
closeStmt(java.sql.Statement stmt)
protected static void
discardDatabaseObject(java.lang.Object x)
Permanently discard database object.protected static org.apache.manifoldcf.core.interfaces.IResultSet
execute(java.sql.Connection connection, java.lang.String query, java.util.ArrayList params, boolean bResults, int maxResults, boolean useName)
Run a query.void
executeOperation(java.lang.String query, java.util.ArrayList params)
Execute operation.IDynamicResultSet
executeUncachedQuery(java.lang.String query, java.util.ArrayList params, int maxResults)
Execute query.protected static int
findColumn(java.sql.ResultSet rs, java.lang.String name)
protected static java.sql.Blob
getBLOB(java.sql.ResultSet rs, int col)
protected static java.sql.Clob
getCLOB(java.sql.ResultSet rs, int col)
protected static org.apache.manifoldcf.core.interfaces.IResultSet
getData(java.sql.ResultSet rs, int maxResults, boolean useName)
protected static java.lang.Object
getObject(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, int col)
protected static void
handleIOException(java.io.IOException e, java.lang.String context)
protected static boolean
isBinaryData(java.sql.ResultSetMetaData rsmd, int col)
protected static boolean
isBLOB(java.sql.ResultSetMetaData rsmd, int col)
protected static boolean
isCLOB(java.sql.ResultSetMetaData rsmd, int col)
protected static void
loadPS(java.sql.PreparedStatement ps, java.util.ArrayList data)
static java.lang.String
readAsString(java.lang.Object o)
Read object as a stringprotected static java.lang.String[]
readColumnNames(java.sql.ResultSetMetaData rsmd, boolean useName)
protected static IDynamicResultRow
readNextResultRow(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, java.lang.String[] resultCols)
protected static IDynamicResultRow
readNextResultRowViaThread(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, java.lang.String[] resultCols)
protected static IDynamicResultRow
readResultRow(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, java.lang.String[] resultCols)
Read the current row from the resultsetvoid
testConnection()
Test connection.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
jdbcProvider
protected java.lang.String jdbcProvider
-
useName
protected boolean useName
-
driverString
protected java.lang.String driverString
-
userName
protected java.lang.String userName
-
password
protected java.lang.String password
-
-
Constructor Detail
-
JDBCConnection
public JDBCConnection(java.lang.String jdbcProvider, boolean useName, java.lang.String host, java.lang.String databaseName, java.lang.String rawDriverString, java.lang.String userName, java.lang.String password) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Constructor.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
-
Method Detail
-
readNextResultRowViaThread
protected static IDynamicResultRow readNextResultRowViaThread(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, java.lang.String[] resultCols) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
readNextResultRow
protected static IDynamicResultRow readNextResultRow(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, java.lang.String[] resultCols) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
closeResultset
protected static void closeResultset(java.sql.ResultSet rs) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
closeStmt
protected static void closeStmt(java.sql.Statement stmt) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
closePS
protected static void closePS(java.sql.PreparedStatement ps) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
testConnection
public void testConnection() throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Test connection.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
executeUncachedQuery
public IDynamicResultSet executeUncachedQuery(java.lang.String query, java.util.ArrayList params, int maxResults) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Execute query.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
executeOperation
public void executeOperation(java.lang.String query, java.util.ArrayList params) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Execute operation.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
readAsString
public static java.lang.String readAsString(java.lang.Object o) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Read object as a string- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
execute
protected static org.apache.manifoldcf.core.interfaces.IResultSet execute(java.sql.Connection connection, java.lang.String query, java.util.ArrayList params, boolean bResults, int maxResults, boolean useName) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Run a query. No caching is involved at all at this level.- Parameters:
query
- String the query stringmaxResults
- is the maximum number of results to load: -1 if allparams
- ArrayList if params !=null, use preparedStatement- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
readResultRow
protected static IDynamicResultRow readResultRow(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, java.lang.String[] resultCols) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
Read the current row from the resultset- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
handleIOException
protected static void handleIOException(java.io.IOException e, java.lang.String context) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
readColumnNames
protected static java.lang.String[] readColumnNames(java.sql.ResultSetMetaData rsmd, boolean useName) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
getData
protected static org.apache.manifoldcf.core.interfaces.IResultSet getData(java.sql.ResultSet rs, int maxResults, boolean useName) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
loadPS
protected static void loadPS(java.sql.PreparedStatement ps, java.util.ArrayList data) throws java.sql.SQLException, org.apache.manifoldcf.core.interfaces.ManifoldCFException
- Throws:
java.sql.SQLException
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
discardDatabaseObject
protected static void discardDatabaseObject(java.lang.Object x) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Permanently discard database object.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
cleanupDatabaseObject
protected static void cleanupDatabaseObject(java.lang.Object x) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Call this method on every parameter or result object, when we're done with it, if it's possible that the object is a BLOB or CLOB.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
cleanupParameters
protected static void cleanupParameters(java.util.ArrayList data) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException
Clean up parameters after query has been triggered.- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
-
findColumn
protected static int findColumn(java.sql.ResultSet rs, java.lang.String name) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
getBLOB
protected static java.sql.Blob getBLOB(java.sql.ResultSet rs, int col) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
getCLOB
protected static java.sql.Clob getCLOB(java.sql.ResultSet rs, int col) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
isBLOB
protected static boolean isBLOB(java.sql.ResultSetMetaData rsmd, int col) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
isBinaryData
protected static boolean isBinaryData(java.sql.ResultSetMetaData rsmd, int col) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
isCLOB
protected static boolean isCLOB(java.sql.ResultSetMetaData rsmd, int col) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
getObject
protected static java.lang.Object getObject(java.sql.ResultSet rs, java.sql.ResultSetMetaData rsmd, int col) throws org.apache.manifoldcf.core.interfaces.ManifoldCFException, org.apache.manifoldcf.agents.interfaces.ServiceInterruption
- Throws:
org.apache.manifoldcf.core.interfaces.ManifoldCFException
org.apache.manifoldcf.agents.interfaces.ServiceInterruption
-
-