locked
Connect to Oracle Database from .Net Framework 3.5 RRS feed

  • Question

  • User827758090 posted

    Hi

    I need to connect to oracle database (10g) which is on differenet server.

    Can i use the latest ODP.net provider or i need to use ODP.net provider related to oracle 10g only???

    After installing the ODP.Net what are the next steps to do in order to connect to database.... Can u guys pls help me... This is totally new to me (connecting to oracle... i have worked with sql databases till now...)

     

    Tuesday, March 8, 2011 2:12 PM

Answers

  • User827758090 posted

    Fixed the issue. I do not have ide whats the exact problem is...

    Uninstalled the existing oracle clients i had oracle 11g done before

    1) Installed the oracle client for 10 g

    2) Installed the ODP.Net drivers for 10g

    3) Test through the SQL Developer (It worked)

    4) In Visual Studio in the connection string i need to give the total connect identifier , not the TNS name.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 9, 2011 3:26 PM

All replies

  • User551462331 posted

    u can use latest ODP.

    if u have worked with sql server then it should be easy to oracle too

    u need to create tns entry (in tnsnames.ora file in oracle->network->admin directory ) of the server u r trying to connect

    then, taste that u can connect to oracle database using oracle tool like sqlplusw /plsql developer/toad etc.

    if everything is working then in web.config of u r app, give servername as tns name and username, pass of oracle database

    use oracleconnection, oraclecommand classes in u r code to create connection and querying

    that should be enough..

    hope this helps...

    Tuesday, March 8, 2011 2:25 PM
  • User827758090 posted

    Thanks Kulkarni

    I have downloaded the ODAC112021.zip universal installer from http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html

    1) After executing this setup file, in the last step it is asking to execute the sql scripts. Where should i execute this scipts????

    2) I got two folders created product\11.2.0\client_1 and product\11.2.0\client_2.

    3) I can see the tnsnames.ora file in only client_2 folder. How to create a tns entry... i need to open with note pad and just add the tns entry??

     

    Tuesday, March 8, 2011 5:28 PM
  • User269602965 posted

    You do not need to run the scripts unless you plan to use Oracle's version of users, roles, accounts, etc.

    You only need one client home.  Not sure how you ended up with two.

    Yes, you will need to add to TNSNAMES.ORA with connection information for the remote database,

    and resolve any firewall issues between the client server and the database server

    to accommodate Oracle's use of listening ports, etc.

     

    Tuesday, March 8, 2011 8:13 PM
  • User551462331 posted

    tns entry in tnsnames.ora file isvery important for oracle connectivity... if u r oracle server is already being used by somebody else or if u have deidecated dba for oracle, then try to get tnsentry from them... generallly tnsentry looks like below..

    tnsName=
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = tnsName)
    )
    )

    here, ip address of oracle server should be provided as host in address field.

    also, servicename should be as per listner configured on oracle database..

    once, tns entry is added in tnsnames.ora file, try connecting to databas using sqlplusw or any other oracle client tool

    then use tnsname (in above entry) as servername in web.config file

    hope this helps..

    Wednesday, March 9, 2011 2:24 AM
  • User827758090 posted

    I have done the above steps.

    When i am trying to connect to oracle database using TNS, it is giving the following error.

    Status : Failure -Error loading native JDBC driver library

     

    Pls need help on this

     

    Wednesday, March 9, 2011 10:07 AM
  • User827758090 posted

    Fixed the issue. I do not have ide whats the exact problem is...

    Uninstalled the existing oracle clients i had oracle 11g done before

    1) Installed the oracle client for 10 g

    2) Installed the ODP.Net drivers for 10g

    3) Test through the SQL Developer (It worked)

    4) In Visual Studio in the connection string i need to give the total connect identifier , not the TNS name.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 9, 2011 3:26 PM