Skip to content

Commit 3ced442

Browse files
author
turingfly
committed
JDBC
1 parent d0600c3 commit 3ced442

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Java-8/src/jdbc/ConnectingADataBase.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public void readingAResultSet() throws SQLException {
108108
}
109109

110110
// closing a Database
111+
/**
112+
*
111113
public void closingDataBase() throws SQLException {
112114
String url = " jdbc:derby:zoo";
113115
try (Connection conn = (Connection) DriverManager.getConnection(url);
@@ -117,6 +119,7 @@ public void closingDataBase() throws SQLException {
117119
System.out.println(rs.getString(1));
118120
}
119121
}
122+
*/
120123

121124
// closing a Database prior to Java 7
122125
public void closingDataBase1() throws SQLException {
@@ -135,7 +138,7 @@ public void closingDataBase1() throws SQLException {
135138
{
136139
closeResultSet(rs);
137140
closeStatement(stmt);
138-
closeConnection(conn);
141+
// closeConnection(conn);
139142
}
140143
}
141144

@@ -155,14 +158,17 @@ private void closeStatement(Statement stmt) {
155158
}
156159
}
157160

161+
/**
158162
private void closeConnection(Connection conn) {
159163
try {
160164
if (conn != null)
161165
conn.close();
162166
} catch (SQLException e) {
163167
}
164168
}
169+
*/
165170

171+
/**
166172
public void dealingWithExceptions() {
167173
String url = " jdbc:derby:zoo";
168174
try (Connection conn = DriverManager.getConnection(url);
@@ -176,4 +182,5 @@ public void dealingWithExceptions() {
176182
System.out.println(e.getErrorCode());
177183
}
178184
}
185+
*/
179186
}

0 commit comments

Comments
 (0)