Eclipse and MySQL -
this question has answer here:
how link eclipse , mysql? have added mysql-connector-java-5.1.38-bin.jar via project>(right-click)>properties>java build path>libraries.
however each time run application, still getting caused by: java.lang.classnotfoundexception: com.mysql.jdbc.driver error. hope can advise. thank you.
when add mysql-connector jar, available class compilations of project code. drivers loaded using reflection, i.e. through class.forname("driver_class_name_here"). happens during run-time , compiler need not bother class name being provided.
usually web-applications packaged war archives , deployed web-containers or servers. when server executes on these archives, expects referred class in classpath. classpath includes many locations , 1 among them web-inf\lib folder of archive.
when build web-archive through eclipse or using build tools ant or maven, need specify included inside archive. on eclipse, through deployment assembly tab on project properties.
for web-project following structure:
we add specific library archive through deployment assembly > add > java build path entries > next, select libraries , finish. specify mysql connector included archive as:


Comments
Post a Comment