如何使用数据源资源管理器从 Eclipse 连接 MySql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31934135/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:47:34  来源:igfitidea点击:

How to Connect MySql from Eclipse using Data Source Explorer

mysqleclipseeclipse-dtp

提问by DurgaPrasad Ravula

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. After that we get Database Connectionsunder the eclipse and then right click on the database connection and click on New...then select MySqlunder Connection Profile Types:and I click on New Driver Definition. Under New Driver Definitiondialog, there exists MySql JDBC Driverwith specific System Version. I choose one, but the OKbutton is disabled. 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".

我需要帮助。你能回答这些问题吗?我想将 eclipse 连接到我的数据库,并且我在 eclipse 中尝试了这些:Window>Show View>Other>Data Source Explorer. 之后我们进入Database Connectionseclipse下然后右键单击数据库连接然后单击New...然后选择MySqlConnection Profile Types:我单击New Driver Definition。在New Driver Definition对话框下,存在MySql JDBC Driver特定的系统版本。我选择了一个,但该OK按钮被禁用。同样在顶部它说:“无法在驱动程序定义中指定的文件系统中找到 JAR/zip:mysql-connector-java-xxx-bin.jar”。



How can I specify a Driver Template and Definition Name under New Driver Definitiondialog of Data Source Explorer (in Data Tools Platform)

如何在New Driver Definition数据源资源管理器的对话框下指定驱动程序模板和定义名称(在数据工具平台中)

回答by Fredrick Gauss

I dont know your Eclipse version or your MySql server version but for Keplerand mysql 5.5 server, here what I did. First I downloaded mysql connector java jar file(mysql-connector-java-5.1.36-bin.jar) from http://dev.mysql.com/downloads. Then On the New Driver Definitiondialog page, I choose MySQL JDBC Driver|MySQL|5.1under Name/Typetag. Go to JAR Listtab Clear alland Add JAR/Zip...and choosed my already downloaded jar file. Finally at the Propertiestab I filled them like this:

我不知道您的 Eclipse 版本或您的 MySql 服务器版本,但对于Keplerand mysql 5.5 server,我在这里做了什么。首先,我从http://dev.mysql.com/downloads下载了 mysql 连接器 java jar 文件(mysql-connector-java-5.1.36-bin.jar)。然后在对话框页面上,我选择标签下。转到选项卡并选择我已经下载的 jar 文件。最后在选项卡上,我像这样填充它们:New Driver DefinitionMySQL JDBC Driver|MySQL|5.1Name/TypeJAR ListClear allAdd JAR/Zip...Properties

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

In the end, OKbutten changed to enabled and that is all.

最后,OKbutten 更改为 enabled ,仅此而已。

回答by Binoy S Kumar

I also faced same issue. Just download the specific mysql JAR file needed. Now you need to add it to the JAR files tab. But before doing it click on clear all. That is the important step.

我也面临同样的问题。只需下载所需的特定 mysql JAR 文件。现在您需要将它添加到 JAR 文件选项卡。但在做之前点击清除所有。这是重要的一步。