Test to See if Your Connection is Alive : Connection « Database « Java Tutorial






  1. For Oracle database: you may use the Connection object with query of "select 1 from dual"; if the query returns the result, then it is a valid Connection object.
  2. For MySQL database: you may use the Connection object with query of "select 1"; if the query returns the result, then it is a valid Connection object.








20.3.Connection
20.3.1.Connection Object
20.3.2.Connection Object Requirements
20.3.3.Connection Properties: Pass additional properties using java.util.Properties:
20.3.4.Passing 'user' and 'password' Parameters as a java.util.Properties Object to Connection object
20.3.5.Test to See if Your Connection is Alive
20.3.6.Vendor URL Formats
20.3.7.Connection's Method to Print Native SQL