青春有我
代码:/*** 获取数据库连接方法*/public Connection getConn() throwsException {Connection conn = null;try {//connection原始的连接方式可以转换为OracleConnectionConnection con =this.commonDao.getCurrentConnection();Connection conWas = null;if(this.wasConnection){//使用tomcat请把biz-context-finance.xml中的wasConnection的值设置为false注释掉biz-context-core.xml中的id="websphereForOracleConnection"内容WebSphereNativeJdbcExtractor websphereForOracleConnection =(WebSphereNativeJdbcExtractor)SpringUtils.getSpringBean("websphereForOracleConnection");conWas = websphereForOracleConnection.getNativeConnection(con);}else{conWas = con;}conWas.setAutoCommit(false);conn =conWas.getMetaData().getConnection();} catch (DaoException e) {e.printStackTrace();}return conn;}