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();
Asked
Active
Viewed 9,985 times
3

Artjom B.
- 61,146
- 24
- 125
- 222

NewBee Developer
- 432
- 2
- 9
- 26
-
You shouldn't need to know. You should create one whenever you need one and close it when done with it. If you want to conserve connect operations, use a connection pool. – user207421 Mar 16 '15 at 15:01
1 Answers
3
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.

uraimo
- 19,081
- 8
- 48
- 55
-
Suppose my requirement is to check first whether the connection is closed.. if yes, then i want to open it.. Then after using the database i want to again close it.... I'm a rookie so please forgive me if this question is silly :) – NewBee Developer Mar 16 '15 at 10:43
-
2
-
getConnection already do that, check this tutorial: http://www.tutorialspoint.com/jdbc/jdbc-db-connections.htm – uraimo Mar 16 '15 at 10:52
-
2@NewBeeDeveloper That's another issue than what is stated in your question and I suggest that you investigate yourself and ask a new question, if you don't find anything useful. As far as I see this answer answers your question. You should consider [accepting](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) it. – Artjom B. Mar 16 '15 at 12:59