java - how to add mysql driver jar file in eclipse -
i have jar file: mysql-connector-java-5.1.14-bin.jar , want add project. add jar @ way: project-> properties -> (java build path) libraries , add external jars. when try use , write:
import com.mysql.jdbc.jdbc2.optional.mysqlconnectionpooldatasource;
import com.mysql.jdbc.jdbc2.optional.mysqldatasource;
i error under "com.mysql".
what mistake?
if jar file jdbc driver appears in "referenced libraries" branch of project, this:

then don't need import statement it. use drivermanager.getconnection() , java should able find jdbc driver itself.
string myconnectionstring = "jdbc:mysql://localhost:3307?" + "useunicode=yes&characterencoding=utf-8"; // following statement assumes // import java.sql.*; connection dbconnection = drivermanager.getconnection(myconnectionstring, "root", "mypassword");
Comments
Post a Comment