如何从SqlServer数据库连接到Oracle数据库 [英] How to connect from SqlServer database to Oracle database

查看:141
本文介绍了如何从SqlServer数据库连接到Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello FRIENDS,



我想从SqlServer连接到oracle数据库。



目前iam在Asp.net上工作c#,SqlServer2005。



以前我们的数据库是SqlServer2005,所以我的所有表都在SqlServer2005数据库中。



我想连接到Oracle数据库,已经安装了Oracle Instant Client。

我有ODBC驱动程序。



现在我想从SqlServer2005数据库连接到ORACLE数据库。



顺便说一下我在Asp.net上工作。所以我应该更改Web.config文件中的连接。



请帮助。谢谢

解决方案





用于将SQL Server迁移到Oracle,请参阅下面的文章。

将Microsoft SQL Server数据库迁移到Oracle Database 11g [ ^ ]

从Microsoft SQL Server迁移到Oracle [< a href =http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html\"target =_ blanktitle =New Window> ^ ]

Oracle SQL Server迁移助手(OracleToSQL) [ ^ ]



用于连接oracle数据库,请参考以下链接。

asp.net中oracle的连接字符串 [ ^ ]



希望它有所帮助。


您应该使用SQL Server中可用的链接服务器选项。 br />
通过连接oracle创建链接服务器并指向数据库连接以访问链接服务器。


你好,



我假设当你说从SQL Server 2005到Oracle意味着你希望你的ASP.NET应用程序连接到Oracle Databse而不是SQL Server 2005.如果这是正确的假设那么请继续阅读剩余的p解决方案的艺术。



使用ODBC驱动程序安装从这里可以获得的Oracle Data Provider For Net(ODP.NET)[^ 。可以在此处找到安装指南[ ^ ]。安装完成后,检查PATH环境变量是否为uptodate。这可以通过打开命令提示符并从C:\>完成。输入sqlplus.exe。如果设置了PATH,您应该看到以下响应。

 SQL * Plus:版本10.2.0.1.0  - 生产于2013年4月22日星期一12:46:44 
版权所有(c)1982,2005,Oracle。版权所有。
输入用户名:



按Ctrl + C停止SQLPlus.exe。您现在可以使用ODP.NET连接到Oracle数据库。



在继续进行之前,您可能需要参考这篇文章[ ^ ]并确保您以独立于提供者的方式编写代码。如果没有,请按照MSDN文章进行相应的更改。您可能还会发现这篇[ ^ ]文章非常有用。



最后一项更改是在项目中实际添加对ODP.NET提供程序的引用。使用类似于下面所示的连接字符串,从您的应用程序建立与Oracle数据库的连接。

用户ID = YOUR_USER;密码= YOUR_PASSWORD;数据源= // HOST: PORT / SERVICE_NAME 

请参阅以下文章以了解有关Oracle连接字符串的更多信息。



问候,

Hello FRIENDS,

I want to connect from SqlServer to oracle database.

Presently iam working on Asp.net c#, SqlServer2005.

Previously our database was SqlServer2005, so all my tables was in SqlServer2005 Database.

I want to connect to Oracle database, already i have Installed Oracle Instant client.
I got ODBC driver.

Now I want to connect from SqlServer2005 database to ORACLE database.

By the way am working on Asp.net. So should i change the connection in Web.config file.

Please help. thanks

解决方案

Hi,

for migrating SQL Server to Oracle, refer below articles.
Migrating a Microsoft SQL Server Database to Oracle Database 11g[^]
Migrating from Microsoft SQL Server to Oracle[^]
SQL Server Migration Assistant for Oracle(OracleToSQL)[^]

for connecting to oracle database, refer below links.
Connection String for oracle in asp.net [^]

hope it helps.


You should use the Linked Server option that''s available in SQL Server.
Create a linked server by connecting the oracle and point your database connection to access the linked server.


Hello,

I am assuming that when you say from SQL Server 2005 to Oracle means you want your ASP.NET application to connect to Oracle Databse instead of SQL Server 2005. If this is correct assumption then please go ahead and read the remaing part of the solution.

Insted of using ODBC driver install Oracle Data Provider For Net (ODP.NET) available from here[^]. The installation guide can be found here [^]. Once it''s installed check whether the PATH environment variable is uptodate. This can be done by opening command prompt and from C:\> type sqlplus.exe. If PATH is set you should see following response.

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 22 12:46:44 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Enter user-name:


Press Ctrl+C to stop SQLPlus.exe. You can now connect to Oracle Database using ODP.NET.

Before proceeding further you may want to refer to this article[^] and ensure that you have written your code in provider independent manner. If not then follow the MSDN article and make appropriate changes to your code. You may also find this[^] article very useful.

The last change will be to actually add reference to ODP.NET provider in your project. Use connection string similar to one shown below to establish connection to Oracle Database from your application.

User Id=YOUR_USER;Password=YOUR_PASSWORD;Data Source=//HOST:PORT/SERVICE_NAME

Please refer to following articles to know more about Oracle Connection Strings.


Regards,


这篇关于如何从SqlServer数据库连接到Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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