Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check whether a database connection is closed or open using java?

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Signing_Utility.mdb;";
Connection con = DriverManager.getConnection(database, "", "");
Statement s = con.createStatement();
like image 290
NewBee Developer Avatar asked Aug 10 '26 17:08

NewBee Developer


1 Answers

Is con.isClosed() good enough? You can check the official documentation of the Connection class here, the oracle documentation is the first place to go when you want to learn more about standard Java classes.

like image 110
uraimo Avatar answered Aug 13 '26 07:08

uraimo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!