Loading a Driver
Load the com.mysql.jdbc.Driver database driver before creating a database connection.
You can load the driver in the following ways:
- Implicit loading at any position before a connection is created in the code: Class.forName("com.mysql.jdbc.Driver");
- During JVM startup, transfer its parameter java -Djdbc.drivers=com.mysql.jdbc.Driver jdbctest, where jdbctest indicates the test case program name.
For a driver of MySQL 8.0 or later, the package name is changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver. When loading the driver, change the package name based on the driver version.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot