Package de.narimo.commons.jdbc
Class JDBCConnectionJNDI
- java.lang.Object
-
- de.narimo.commons.jdbc.JDBCConnectionJNDI
-
public class JDBCConnectionJNDI extends Object
-
-
Constructor Summary
Constructors Constructor Description JDBCConnectionJNDI(String JNDIResource)JNDI Resource name as defined inin web.xml.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.voidcloseAll()voidcommit()booleanexecute(String sql)ResultSetexecutePreparedQuery(PreparedStatement ps)Returns a ResultSet.intexecutePreparedUpdate(PreparedStatement ps)ResultSetexecuteQuery(String sql)booleangetAutoCommit()intgetConnectionId()booleanisClosed()static voidmain(String[] args)PreparedStatementprepareStatement(String sql)Returns a PreparedStatement.voidrollback()voidsetAutoCommit(boolean autoCommit)
-
-
-
Method Detail
-
prepareStatement
public PreparedStatement prepareStatement(String sql) throws Exception
Returns a PreparedStatement. The PreparedStatement must be explicitly closed after use, to prevent connection leaks!- Parameters:
sql-- Returns:
- Throws:
Exception
-
executePreparedQuery
public ResultSet executePreparedQuery(PreparedStatement ps) throws Exception
Returns a ResultSet. The ResultSet must be explicitly closed after use, to prevent connection leaks!- Parameters:
ps-- Returns:
- Throws:
Exception
-
executePreparedUpdate
public int executePreparedUpdate(PreparedStatement ps) throws Exception
- Throws:
Exception
-
close
@Deprecated public void close() throws SQLException
Deprecated.- Throws:
SQLException
-
closeAll
public void closeAll()
-
commit
public void commit() throws SQLException- Throws:
SQLException
-
rollback
public void rollback() throws SQLException- Throws:
SQLException
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws SQLException- Throws:
SQLException
-
getConnectionId
public int getConnectionId()
-
isClosed
public boolean isClosed() throws SQLException- Throws:
SQLException
-
getAutoCommit
public boolean getAutoCommit() throws SQLException- Throws:
SQLException
-
main
public static void main(String[] args) throws SQLException
- Throws:
SQLException
-
-