此问题已在此处有答案:
How should I use try-with-resources with JDBC?(5个答案)
关闭28分钟前.
public String getDatabaseProductName() throws SQLException {
Connection connection = dataSource.getConnection();
DatabaseMetaData metaData = connection.getMetaData();
return metaData.getDatabaseProductName();
}
我正在尝试解析-Use try-with resources or close this "connection" in a finally clause
要关闭的连接并返回- DatabaseProductName。
1条答案
按热度按时间gwbalxhn1#