Code example for Connection

Methods: getAutoCommitisClosedsetAutoCommit

0
	 
	private Connection conn = null;
	 
	public Connection getConn() {
		try { 
			if (null == conn || conn.isClosed()) {
					conn = JdbcUtils.getConnectionByPoolableDataSource("root", "123456", "jdbc:mysql://localhost:3306/taobaomonitor_schema");
			} 
			if (conn.getAutoCommit()) {
				conn.setAutoCommit(false);
			} 
		} catch (SQLException e) {
			log.error(e);
			throw new RuntimeException(e);
		} catch (Exception e) {
			log.error(e);
			throw new RuntimeException(e);
		} 
		return conn;
	} 
Contextual code suggestions in your IDE  Get Codota for Java