oracle JDBC使用例子

前端之家收集整理的这篇文章主要介绍了oracle JDBC使用例子前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Connection orcDbConn = getOracleConnect();
orcDbConn.setAutoCommit(false);
PreparedStatement statement =orcDbConn.prepareStatement("INSERT INTO INVITEKEYTMP SELECT I.ID FROM INVITE I WHERE I.REBATE_STATE ='0' and INVITE_TIME>=TO_DATE(?,'yyyy-MM-dd') ");
statement.setQueryTimeout(QUERY_TIMEOUT);
statement.execute();
orcDbConn.commit();
<span style="font-family: Arial,Helvetica,sans-serif;">statement.close();</span><span style="white-space:pre">
</span>orcDbConn.close();


	public Connection getOracleConnect() throws Exception {
		Connection orcDbConn = null;

		try {
			// 初始化驱动包
			Class.forName(proCon.getProperty("driverClass"));
			// 根据数据库连接字符,名称,密码给conn赋值
			orcDbConn = DriverManager.getConnection(proCon.getProperty("jdbcUrl"),proCon.getProperty("user"),proCon.getProperty("password"));

		} catch (Exception ex) {
			throw ex;
		}

		return orcDbConn;
	}
原文链接:https://www.f2er.com/oracle/213634.html

猜你在找的Oracle相关文章