打开eclipse,选择Window→Open Perspective→Other→Database Development,然后在右边的导航栏右键点击Database Connections文件夹,选择new,选择MySQL,选next,进行相关的配置。
如果没有驱动,先定义一个新的驱动,点击Drivers栏后边的图标进行New Driver Definition:
1.在Name/Type里选择MySQL版本,然后给驱动命名。
2.在JAR List导入驱动jar包(譬如mysql-connector-java-5.0.8-bin.jar),如果显示Unable to locate JAR/zip in file system as specified by the driver definition: mysql-connector-3.java-5.0.0-bin.jar.错误,请将该jar包复制到jre路径下:譬如jdk1.6.0_10jrelibextmysql-connector-java-5.0.8-bin.jar
3.在Properties配置相应URL、Database Name、Password和Username等
4.配置成功后点ok
先点击Test Connection,弹出success就成功了,最后点击finish