使用eclipse连接mysql和java [英] connect mysql with java using eclipse

查看:156
本文介绍了使用eclipse连接mysql和java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用这些语句在Java应用程序中使用eclipse连接mysql与

i can connect mysql with java using eclipse in a java application with these statements

String unicode = "?useUnicode=yes&characterEncoding=UTF-8";
Class.forName("com.mysql.jdbc.Driver");
            con = (Connection) DriverManager.getConnection(
                    "jdbc:mysql://localhost:3306/ams-competation" + unicode,
                    username, password);

并且效果不错

问题是当我试图连接到mysql与服务器应用程序,我有这个异常

but my problem is when i tried to connect to mysql with a server application i got this exception

java.lang.ClassNotFoundException:com.mysql.jdbc。 Driver
我做错了什么谢谢所有

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver what am i doing wrong?thank you all

i have added mysql-connector already

i have added mysql-connector already

推荐答案

将mysql-connector-java .. jar文件放入您的web项目lib文件夹

put mysql-connector-java.. jar file in your web projects lib folder

这篇关于使用eclipse连接mysql和java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆