After this example also mentioned solution.Ĭonnection con = DriverManager. This will throw ClassNotFoundException because sql driver jar is not in classpath. The loadClass method in class ClassLoader.ĬlassLoader.loadClass(, boolean)Äifference between Class.forName() and ClassLoader.loadClass()Ä«elow is example of connecting with database and retrieve data from sql table.If not, the JAR should be added to the classpath in Java and the application should be recompiled. Check whether this JAR is present in the application classpath. For example, in the case of, the JAR file that contains it is mysql-connector-java.jar. The findSystemClass method in the class ClassLoader. Find out which JAR file contains the problematic Java class.The major important issue needs to take care of while development of a project using. The connection string and the driver class are shown below:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |