No suitable driver found for jdbc问题

Today there has been emergence of coding No suitable driver found for jdbc, but also searched the information online, basically saying is three questions:
First: the connection URL format there is a problem (Connection conn = DriverManager.getConnection ( "jdbc : mysql: // localhost: 3306 / XX "," root "," XXXX ")
Second: drive string error (com.mysql.jdbc.Driver)
Third, the Classpath is not a member suitable mysql_jdbc drive
after I double-check this three errors I did not commit, why?
try to mysql-connector-java-3.1.14- bin.jar jar package added C: \ Program files \ Java \ jre1.6.0_02 \ lib \ ext file next clip, problem solved !!

Turned out to be not only requires the drive to join the classpath, and need to be added to the outside of the jar package jar package java runtime environment, well, next time such a stupid mistake or less made better.

Released seven original articles · won praise 0 · Views 3

Guess you like

Origin blog.csdn.net/weixin_45221036/article/details/104993618