The current justification is not related with the question at all. The correct explanation should include all the three DriverManager.getConnection() overloads and the correct order of invoking the methods.
In this case, create a Properties object to put all parameters together, set all desired properties, then invoke the correct DriverManager.getConnection() overload (String, Properties) - in this case.
Plus, there is no method Connection.connect().
Did I say something wrong, improper or ambiguous? Please, feel free to comment.
About Question enthuware.ocpjp.v8.2.1767 :
Moderator: admin
-
- Posts: 3
- Joined: Mon Mar 28, 2022 10:49 am
- Contact:
-
- Posts: 3
- Joined: Mon Mar 28, 2022 10:49 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1767 :
Applications no longer need to explicitly load JDBC drivers using Class.forName(). The DriverManager methods getConnection and getDrivers have been enhanced to support the Java Standard Edition Service Provider mechanism. JDBC 4.0 Drivers must include the file META-INF/services/java.sql.Driver. This file contains the name of the JDBC drivers implementation of java.sql.Driver. For example, to load the my.sql.Driver class, the META-INF/services/java.sql.Driver file would contain the entry: my.sql.Driver When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application.
-
- Site Admin
- Posts: 10053
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1767 :
Explanation has been enhanced to include your suggestion.
thank you for your feedback!
thank you for your feedback!
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 37 guests