package com.vci.server.base.dbutil; import java.sql.Connection; import com.vci.common.log.ServerWithLog4j; public class DbOperation { /** * get a db connection and a statement * */ public DbOperation() { } public static Connection getConnect() { Connection cnn = null; try { cnn = DBPoolManagement.getConnection(); if (cnn == null) { ServerWithLog4j.logger.warn("--db connet is null!---"); } cnn.setAutoCommit(false); } catch (Exception e) { e.printStackTrace(); cnn = null; } return cnn; } /** * release the current connection. * */ public static void releaseConnection(Connection cnn) { try { if (cnn != null) { cnn.close(); } } catch (Exception e) { e.printStackTrace(); } finally { if ( cnn != null ) { try { cnn.close(); } catch (Exception e1){ } } } } }