- Using
Class.forName
method in static block to load MySQL Driver class at runtime whenDBUtil
class is used fist time. So, driver class is loaded and registered once. We don't need additional method to load driver class every time we want to get connection. - Since JDBC 4.0, we don't need to explicitly load driver class. But, it is good practice to load driver class explicitly for backward compatibility.
- Using
getConnection
method for getting Connection based on url, username and password. - Using
handleSQLException
method to handleSQLException
.
-
Notifications
You must be signed in to change notification settings - Fork 0
elshadzarbali/jdbc-mysql-example
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
My example for creating JDBC application interacting with MySQL database
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published