Skip to content

Commit 2c99c9a

Browse files
author
Nirmala Sundarappa
committed
Modified Tomcat Servlet
1 parent f0c767b commit 2c99c9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

java/jdbc/Tomcat_Servlet/src/JDBCSample_Servlet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
4444
try (Connection connection = ds.getConnection()) {
4545
for (int i=0; i<10; i++) {
4646
out.println("The database user is"
47-
+ executeBusinessLogicOnDatabase(connection));
47+
+ executeBusinessLogicOnDatabase(connection, out));
4848
}
4949
out.print("\n Sample JDBC Servlet Request was successful");
5050
response.setStatus(200);
@@ -75,8 +75,8 @@ private DataSource getDataSource() throws NamingException {
7575
/*
7676
* Method to showcase database operations using the database connection
7777
*/
78-
private String executeBusinessLogicOnDatabase(Connection conn)
79-
throws SQLException {
78+
private String executeBusinessLogicOnDatabase(Connection conn,
79+
PrintWriter out) throws SQLException {
8080
// Get the JDBC driver name and version
8181
DatabaseMetaData dbmd = conn.getMetaData();
8282
out.println("Driver Name: " + dbmd.getDriverName());

0 commit comments

Comments
 (0)