Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Comments
Joezer BH 22-Apr-13 3:16am    
Do you want to migrate your data from SQL to Oracle?

Do you wish to connect to both DBs? (there is no problem with that you can have multiple connections to several DBs or even several connections to a single DB)

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.
 
Share this answer
 
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.
 
Share this answer
 
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,
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900