+ Reply to Thread
Results 1 to 4 of 4

Unable to connect to oracle database (ORA-12541: TNS:no listener

  1. #1
    Registered User
    Join Date
    09-10-2018
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    3

    Unable to connect to oracle database (ORA-12541: TNS:no listener

    I have below excel macro to connect to oracle database. But, one executing the code, I get the error message -

    "Run-time error '-2147467259 (80004005)': ORA-12541:TNS:no listener"

    Please help me resolve this error message.

    I have 'Oracle SQL Developer 3.2' installed on my pc.

    Sub connectToCISDB()

    Dim dbCon As New ADODB.Connection
    Dim recordSet As New ADODB.recordSet
    Dim strQuery, strCon As String

    strQuery = "select * from SAPSR3.eanlh;"

    Set dbCon = New ADODB.Connection
    dbCon.Open "Provider=OraOLEDB.Oracle;User ID=xautotext;Password=F7_kxxxxZS;Data Source=ouxxpdxx1"
    End Sub

    TNSNAMES.ORA File:
    CIS =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oudppdcis01)(PORT = 1526))
    (CONNECT_DATA =
    (SID = [AUG])
    )
    )

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Excel 2010 2016
    Posts
    3,315

    Re: Unable to connect to oracle database (ORA-12541: TNS:no listener

    Then you're missing the ODBC connection or the credentials are incorrect
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    09-10-2018
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    3

    Re: Unable to connect to oracle database (ORA-12541: TNS:no listener

    I am able to connect to the db and query tables successfully from Oracle SQL Developer.

  4. #4
    Registered User
    Join Date
    09-10-2018
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    3

    Re: Unable to connect to oracle database (ORA-12541: TNS:no listener

    Using the right connectionstring resolved the issue.

    Connection String: Driver={Microsoft ODBC for Oracle}; Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.199.199.199)(PORT=1523))(CONNECT_DATA=(SID=dbName))); Uid=myUsername;Pwd=myPassword;

    No TSN nor DSN required.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1