Updated on 2024-05-07 GMT+08:00

Loading a Driver

Load the database driver before creating a database connection.

You can load the driver in the following ways:
  • Implicitly load the driver at any position before a connection is created in the code: Class.forName("org.postgresql.Driver"). For details about the code for creating a connection, see Examples.
  • Specify the driver name when a JVM is started. This parameter is used to execute Java code in the DOS window or on Linux. Example: java -Djdbc.drivers=org.postgresql.Driver jdbctest.

    jdbctest is the name of a test application.