我正在使用jdbc連接,並使用eclipse。我已將連接驅動程序即mysql-connector-java-5.1.6.jar文件中的WebContent/WEB-INF/lib文件夾中。在那之後我寫此代碼簡單地創建和應用程序和驅動程序eclipse中的JDBC連接驅動程序問題
import java.lang.ClassNotFoundException;
public class implementation {
public static void main(String[]arg)
{
try
{
System.out.println("conneting to driver...");
Class.forName("com.mysql.jdbc.driver");
System.out.println("Connection Successful");
}
catch(ClassNotFoundException error)
{
System.out.println("Error:" + error.getMessage());
}
}
}
當我運行這個程序,我得到這個錯誤之間的測試連接。
連接到驅動程序。
錯誤:com.mysql.jdbc.driver
可以請您幫助解決這個問題。謝謝你給我你的重要時間。
檢查了這一點: http://stackoverflow.com/questions/4318382/class-not-found-exception-for-com-mysql-jdbc-driver-not-a-classpath-problem 這應該可以解決你的問題。 – root