简体   繁体   English

如何使用Data Source Explorer从Eclipse连接MySql

[英]How to Connect MySql from Eclipse using Data Source Explorer

I need help. 我需要帮助。 Could you please answer these question? 你能回答这些问题吗? I would like to connect eclipse to my database and I have tried these in eclipse: Window>Show View>Other>Data Source Explorer . 我想将eclipse连接到我的数据库,我在eclipse中尝试了这些: Window>Show View>Other>Data Source Explorer After that we get Database Connections under the eclipse and then right click on the database connection and click on New... then select MySql under Connection Profile Types: and I click on New Driver Definition . 之后我们在eclipse下获得Database Connections ,然后右键单击数据库连接并单击New...然后在Connection Profile Types:下选择MySql Connection Profile Types:然后单击New Driver Definition Under New Driver Definition dialog, there exists MySql JDBC Driver with specific System Version. 在“ New Driver Definition对话框下,存在具有特定系统版本的MySql JDBC Driver I choose one, but the OK button is disabled. 我选择了一个,但是OK按钮被禁用。 Also at the top it says: " Unable to locate JAR/zip in file system as specified by the driver definition: mysql-connector-java-xxx-bin.jar ". 同样在顶部它说:“ 无法在驱动程序定义指定的文件系统中找到JAR / zip:mysql-connector-java-xxx-bin.jar ”。


How can I specify a Driver Template and Definition Name under New Driver Definition dialog of Data Source Explorer (in Data Tools Platform) 如何在Data Source Explorer的New Driver Definition对话框中指定驱动程序模板和定义名称(在Data Tools Platform中)

I dont know your Eclipse version or your MySql server version but for Kepler and mysql 5.5 server , here what I did. 我不知道你的Eclipse版本或你的MySql服务器版本,但对于Keplermysql 5.5 server ,我在这里做了什么。 First I downloaded mysql connector java jar file( mysql-connector-java-5.1.36-bin.jar ) from http://dev.mysql.com/downloads . 首先,我从http://dev.mysql.com/downloads下载了mysql连接器java jar文件( mysql-connector-java-5.1.36-bin.jar )。 Then On the New Driver Definition dialog page, I choose MySQL JDBC Driver|MySQL|5.1 under Name/Type tag. 然后在New Driver Definition对话框页面上,我选择Name/Type标签下的MySQL JDBC Driver|MySQL|5.1 Go to JAR List tab Clear all and Add JAR/Zip... and choosed my already downloaded jar file. 转到JAR List选项卡Clear allAdd JAR/Zip...并选择我已下载的jar文件。 Finally at the Properties tab I filled them like this: 最后在Properties选项卡中我填充它们:

  • Connection URL : jdbc:mysql://localhost:3306 连接URLjdbc:mysql://localhost:3306
  • Database Name : MyDatabaseNameHere 数据库名称MyDatabaseNameHere
  • Driver Class : com.mysql.jdbc.Driver 驱动程序类com.mysql.jdbc.Driver
  • Password : MyPasswordHere 密码MyPasswordHere
  • User ID : root 用户IDroot

In the end, OK butten changed to enabled and that is all. 最后, OK butten更改为启用,这就是全部。

I also faced same issue. 我也面临同样的问题。 Just download the specific mysql JAR file needed. 只需下载所需的特定mysql JAR文件。 Now you need to add it to the JAR files tab. 现在您需要将其添加到JAR文件选项卡。 But before doing it click on clear all. 但在此之前点击清除所有。 That is the important step. 这是重要的一步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM