Write My Paper Button

WhatsApp Widget

Consider the following class: import java.sql. ; public class ConnDBServer / public Connection con; public ConnDBServer()…

Homework Help Question & Answers

Consider the following class: import java.sql. ; public class ConnDBServer / public Connection con; public ConnDBServer()…

Consider the following class: import java.sql. ; public class ConnDBServer / public Connection con; public ConnDBServer() { try class.ForName(“com.mysql.jdbc.Driver”); String url – “.jdbc.mysql://localhost:3306/db1”; con – DriverManager.getConnection(url, “root”, “root”); catch (ClassNotFoundException e) { e.printStackTrace(); catch (SOLException e) { e.printStackTrace(); LaSalle College 2020-05-01 (v. 1.7) colo 22005010. 1.7 It is used to create a connection to the MySQL database db1. For example: import java.sql.* ; public class Main public static void main(String[] args) { Connection con- new ConnDBServer().con; Make the necessary changes in the Conn DBServer class to ensure that in the application we will always use the same connection, that we will not have more than one connection to the database. Ensure as well that the connection will be created only when it is actually needed for the first time. Show how in the main function we will call this connection.
0 0
Add a comment
Don`t copy text!
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
???? Hi, how can I help?