locked
Data Source for remote oracle database from C# RRS feed

  • Question

  • Hi All,

    I am working on accessing data from an oracle database. I am able to do so for local machine when the application and database is on the same machine.

    Now I want do make it run on a remote PC which does not have Oracle.

    When I searched on the net it says it requires Data Source which i am not able to find somehow.

    my machine's IP is 172.28.2.4 and database name is "ORCL" user id - sysman and password :- abc123abc;

    Please guide me how to write the connection string for the oracle access from the remote.

    Thank you in advance....

    Tuesday, July 10, 2012 11:16 AM

Answers

  • I try to summarize what I have understood about your problem:

    1) You developed an application that uses the Oracle DBMS to persist data

    2) Your application runs fine on your development machine

    3) You want (as usual) to run your application on a different production machine

    You need to:

    1) Put your connection string in the app.config file and check your application still works on your development machine

    2) Install a version of ODTwithODAC corresponding to your Oracle DBMS (10 if 10g, 11 if 11g) on the production machine

    3) Build your application and copy build output to the production machine

    4) Change the connection string in the app.config file on the production machine

    5) Run your app on the production machine

    Oracle is a quite tricky server to set up, maintain and configure also for connections: it's not all in ODP client e code but you also have to know about things like tsnames.ora, ezconnect, and so on :(

    These links can help you go further:

    http://docs.oracle.com/html/E10927_01/featConnecting.htm

    http://www.connectionstrings.com/oracle#p12

    Thursday, July 12, 2012 8:00 AM

All replies

  • You need to install ODAC on the machine from which you install the software (the version without VS tools):

    http://www.oracle.com/technetwork/database/windows/downloads/index-101290.html

    Tuesday, July 10, 2012 11:22 AM
  • Connection String

    string strConnectionString= "Data Source=(DESCRIPTION=" + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=_YOUR_SERVER_NAME_)(PORT=_YOUR_SERVER_PORT_)))" + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=_YOUR_SERVICE_NAME_)));" + "User Id=YourUserID;Password=YourPassword;";

    Before that your neet to install oracle client in your machine

    Please check the link of downloading ADO.NET drivers

    http://www.oracle.com/technetwork/topics/index.html


    With Thanks and Regards
    Sambath Raj.C
    click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you
    Happy Programming!

    Tuesday, July 10, 2012 12:00 PM
  • I have installed ODTwithODAC112030.zip  from the above link which you are saying to do so.

    I have a problem with remote access of my oracle database on the local machine its working fine...

    Wednesday, July 11, 2012 2:53 AM
  • you can try the following code

    SqlConnection conn = new SqlConnection("Data Source = 172.28.2.4; Initial Catalog = ORCL; User Id = sysman; Password = abc123abc;");

    The following link are very usefull when you connect 

    http://stackoverflow.com/questions/4688468/how-to-connect-to-remote-oracle-database-using-system-data-oracleclient-in-c-sha

    http://www.connectionstrings.com/oracle#p19


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/

    Wednesday, July 11, 2012 5:03 AM
  • Hi Selvam,

    Thank you for your code,

    But I wanted it for oracle connection and not sqlconnection I think we don't require initial catalog for oracle connection.

    will you provide me with it.

    thank you in advance..

    Thursday, July 12, 2012 3:16 AM
  • you can check the following link for more deatils

    http://docs.oracle.com/cd/B28359_01/appdev.111/b28844/building_odt.htm

    you need install Oracle Client and Oracle Data Provider for .NET installed on the application machine. you can use above connectionstring web get the correct connection string


    Thanks and Regards Selvam http://www15.brinkster.com/selvamselvam/


    • Edited by Selvam Thursday, July 12, 2012 4:56 AM
    Thursday, July 12, 2012 4:54 AM
  • I try to summarize what I have understood about your problem:

    1) You developed an application that uses the Oracle DBMS to persist data

    2) Your application runs fine on your development machine

    3) You want (as usual) to run your application on a different production machine

    You need to:

    1) Put your connection string in the app.config file and check your application still works on your development machine

    2) Install a version of ODTwithODAC corresponding to your Oracle DBMS (10 if 10g, 11 if 11g) on the production machine

    3) Build your application and copy build output to the production machine

    4) Change the connection string in the app.config file on the production machine

    5) Run your app on the production machine

    Oracle is a quite tricky server to set up, maintain and configure also for connections: it's not all in ODP client e code but you also have to know about things like tsnames.ora, ezconnect, and so on :(

    These links can help you go further:

    http://docs.oracle.com/html/E10927_01/featConnecting.htm

    http://www.connectionstrings.com/oracle#p12

    Thursday, July 12, 2012 8:00 AM