Results 1 to 3 of 3

Thread: Connect to Oracle Database

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    INDIAN, Now in Dubai,UAE
    Posts
    13

    Post

    I tried the single line connection code like this
    cn.Open "Provider=MSDAORA.1;Data Source=Personal Oracle7;User Id=SCOTT;Password=TIGER;"
    but am getting error message like this
    "Runtime error - 2147467259(80004005)
    ORA-12154-TNS:Could not resolve service name"
    I am using Personal Oracle 7.3.4
    I think the error is in Data Source string
    Please help me
    thanks

    [This message has been edited by ipmurali (edited 01-11-2000).]

  2. #2
    New Member
    Join Date
    Jan 2000
    Location
    Kennesaw, GA
    Posts
    5

    Post

    This should work. Go into Oracle's SQL Net Easy Configuration utility and create an Alias for the Oracle Service you want to connect to. For example, you create an Alias named 'ThisAlias', using the 'named pipes' protocol, and you enter the Oracle server's name and the database instance. Now you can go into the ODBC administrator in Control Panel and create a DSN for Oracle. Choose the Oracle73 driver, then give the DSN a name and a description. Where it asks you for 'SQL Net Connect String', enter the name of the alias ('ThisAlias') that you created in the previous step. You can test the new DSN using the '32-bit ODBC TEST' utility. Assuming it works, now you can connect to the Oracle DB through ADO using a connect string of "DSN=ThisAlias, UID=sa, PWD=pwd;"

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Or you can use a one line connection string here

    Add reference to Microsoft ActiveX Data Objects 2.x Libarary (x = 0 or 1)

    Code:
        Dim rs As Recordset
        Dim cn As Connection
        Set cn = New Connection
        
        
        cn.Open "Provider=MSDAORA.1;Data Source=ServerName;User Id=stocks;Password=stocks;"
    
    
        Set rs = cn.Execute("Select * from MyTable")
        
        
        Do Until rs.EOF = True
            Debug.Print rs.Fields(0).Value
            rs.MoveNext
        Loop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width