从 Oracle 数据建模器创建到 SQL 服务器数据库的连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15267532/
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 01:29:52  来源:igfitidea点击:

Create connection to SQL server DB from Oracle data modeler

oraclesql-server-2005jdbc

提问by Gargi Narain

I'm trying to connect to MS SQL Server 2005 from Oracle SQL Developer Data Modeler 3.1.4.710. I go to File -> Import ->Data Dictionary and then try to create a connection to SQL Server.

我正在尝试从 Oracle SQL Developer Data Modeler 3.1.4.710 连接到 MS SQL Server 2005。我转到文件 -> 导入 -> 数据字典,然后尝试创建与 SQL Server 的连接。

I keep getting "Status : Failure -Test failed: Driver class not found. Verify the Driver location" error.

我不断得到 "Status : Failure -Test failed: Driver class not found. Verify the Driver location" error.

I'm using JDBC URL: jdbc:sqlserver://testServer/sqlexpress;databaseName=testDB;integratedSecurity=true;

我正在使用 JDBC URL: jdbc:sqlserver://testServer/sqlexpress;databaseName=testDB;integratedSecurity=true;

Driver Class: CLASSPATH =.;C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc.jar

Driver Class: CLASSPATH =.;C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc.jar

I tried sqljdbc4.jarto no avail.

我试过sqljdbc4.jar无济于事。

I also tried "com.microsoft.sqlserver.jdbc.SQLServerDriver" still no luck. Could you please help?

我也试过“ com.microsoft.sqlserver.jdbc.SQLServerDriver”仍然没有运气。能否请你帮忙?

Here is the screenshot.. enter image description here

这是截图。。 在此处输入图片说明

采纳答案by Gargi Narain

I was able o figure it out.

我能够弄清楚。

Here's what I did:

这是我所做的:

JDBC URL: jdbc:sqlserver://testServer\SQLEXPRESS/Databases/testDB:1433;user=sa;password=pass; Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver

JDBC URL:jdbc:sqlserver://testServer\SQLEXPRESS/Databases/testDB:1433;user=sa;password=pass; 驱动程序类:com.microsoft.sqlserver.jdbc.SQLServerDriver

Also I added sqljdbc4.jar in Prefrences. (under Tools option).

我还在 Prefrences 中添加了 sqljdbc4.jar。(在工具选项下)。

Make sure that 1433 port is set in SQL Server. to do so, perform below steps:

确保在 SQL Server 中设置了 1433 端口。为此,请执行以下步骤:

  1. Open SQL Server Configuration Manager, and then expand SQL Server 2005 Network Configuration.
  2. Click Protocols for InstanceName, and then make sure TCP/IP is enabled in the right panel and double-click TCP/IP.
  3. On the Protocol tab, notice the value of the Listen All item.
  4. Click the IP Addresses tab: If the value of Listen All is yes, the TCP/IP port number for this instance of SQL Server 2005 is the value of the TCP Dynamic Ports item under IPAll. If the value of Listen All is no, the TCP/IP port number for this instance of SQL Server 2005 is the value of the TCP Dynamic Ports item for a specific IP address.
  5. Make sure the TCP Port is 1433.
  6. Click OK.
  1. 打开 SQL Server 配置管理器,然后展开 SQL Server 2005 网络配置。
  2. 单击 InstanceName 的协议,然后确保在右侧面板中启用了 TCP/IP,然后双击 TCP/IP。
  3. 在 Protocol 选项卡上,注意 Listen All 项的值。
  4. 单击“IP 地址”选项卡:如果“全部侦听”的值为“是”,则此 SQL Server 2005 实例的 TCP/IP 端口号就是 IPAll 下的“TCP 动态端口”项的值。如果 Listen All 的值为 no,则此 SQL Server 2005 实例的 TCP/IP 端口号是特定 IP 地址的 TCP 动态端口项的值。
  5. 确保 TCP 端口为 1433。
  6. 单击确定。

回答by jprmig

You can also use ODBC driver. I am not sure if ODBC driver is installed with SQL Server or native to Windows or you have to install it separately.

您也可以使用 ODBC 驱动程序。我不确定 ODBC 驱动程序是随 SQL Server 安装的还是 Windows 本地安装的,或者您必须单独安装它。

If using Windows XP:

如果使用 Windows XP:

--ODBC--

--ODBC--

Start Button -> Setting -> Control Panel -> Admin Tools -> Data Sources (ODBC)

开始按钮 -> 设置 -> 控制面板 -> 管理工具 -> 数据源 (ODBC)

After opening the ODBC Data Source Administrator if not on then go to -User DSN- tab

打开 ODBC 数据源管理器后,如果未打开,则转到 -User DSN- 选项卡

Click Add -> Choose SQL Server Native Client 10.0 ->

单击添加 -> 选择 SQL Server Native Client 10.0 ->

Name: ex: AdventureWorks2008 Server: "SQL Server Name" from drop down box example: (local) or SQL Server name initially specified during setup->

名称:例如:AdventureWorks2008 服务器:下拉框中的“SQL Server 名称”示例:(本地)或最初在安装过程中指定的 SQL Server 名称->

Next ->

下一步 ->

How Should SQL Server verify authenticity? Choose how you want to connect to db Windows integrated or SQL server (if SQL Server then add user parameters eg user= sa pass='*')

SQL Server 应该如何验证真实性?选择您希望如何连接到 db Windows 集成或 SQL 服务器(如果 SQL Server 然后添加用户参数,例如 user= sa pass=' *')

Next ->

下一步 ->

Change default database to AdvetureWorks2008 -> Next 'dont touch anything here unless...-> and click Finish -> click on Test Data Source -> OK

将默认数据库更改为 AdvetureWorks2008 -> Next '不要在这里碰任何东西,除非...-> 并单击 Finish -> 单击 Test Data Source -> OK

--Data Modeler--

--数据建模师--

Now Goto Oracle SQL Data Modeler (mine is Ver 4.00)

现在转到 Oracle SQL Data Modeler(我的是 Ver 4.00)

First if you already have something in your Relational Model then create a new Relational Model in the Data Modeler browser -> RightClick -> New Relational Model - this will hold your imported data dictionary from the SQL Server

首先,如果您的关系模型中已经有一些东西,那么在数据建模器浏览器中创建一个新的关系模型 -> 右键单击​​ -> 新关系模型 - 这将保存您从 SQL Server 导入的数据字典

File -> Import -> Data Dictionary (you are now on Data Dictionary Import Wizard)

文件 -> 导入 -> 数据字典(您现在位于数据字典导入向导)

Click Add-> Connection Name: Ex: AdventureWorks2008 -'you can give it any name, you'll be able to connect to any db within SQL Server'

单击添加-> 连接名称:例如:AdventureWorks2008 -'你可以给它任何名称,你将能够连接到 SQL Server 中的任何数据库'

Click on JDBC tab and bring up JDBC-ODBC bridge (option button - click if not clicked on by default) -> ODBC Alias: AdventureWorks2008 (exactly as you specified in the ODBC setup)

单击 JDBC 选项卡并调出 JDBC-ODBC 桥(选项按钮 - 如果默认情况下未单击,则单击)-> ODBC 别名:AdventureWorks2008(与您在 ODBC 设置中指定的完全相同)

Database Type: SQL Server

数据库类型:SQL Server

Click on -Test- to make sure connecting successfully.

单击 -Test- 以确保连接成功。

Click Save

点击保存

Click Connect

点击连接

You're still on the Data Dictionary Connection Wizard

您仍在使用数据字典连接向导

Highlight the name of the connection "AdventureWorks2008"

突出显示连接名称“AdventureWorks2008”

Click Next -> Choose db you want ex: AdventureWorks2008 -> Next -> Choose tables you want ->next -> Finish

单击下一步 -> 选择您想要的数据库,例如:AdventureWorks2008 -> 下一步 -> 选择您想要的表 -> 下一步 -> 完成

回答by edz

This is wild but I found that when I added the SYBASE JDBC driver to Tools| Preferences | Database | Third Party JDBC drivers then my SQL Server connections started to work. I had a Microsoft JDBC driver added but until I added the Sybase JDBC driver, the connections would fail and not even reach the SQL Server instance. This may be because both Sybase and MS SQL use TDS data streams. The Sybase file I added was jtds-1.3.1.jar. Note: I wasn't using the JDBC tab, I was using the SQL Server tab in Connections.

这很疯狂,但我发现当我将 SYBASE JDBC 驱动程序添加到 Tools| 时 偏好 | 数据库 | 第三方 JDBC 驱动程序然后我的 SQL Server 连接开始工作。我添加了 Microsoft JDBC 驱动程序,但在添加 Sybase JDBC 驱动程序之前,连接将失败,甚至无法到达 SQL Server 实例。这可能是因为 Sybase 和 MS SQL 都使用 TDS 数据流。我添加的 Sybase 文件是 jtds-1.3.1.jar。注意:我没有使用 JDBC 选项卡,我使用的是连接中的 SQL Server 选项卡。