+ 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
    Office 2021 (Windows)
    Posts
    7,905

    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)

Similar Threads

  1. Unable to connect to MS Access database which links to SQL databases
    By stuartrobins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2018, 08:40 AM
  2. How to connect Excel VBA to Oracle Database to get data.
    By hmanhha in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2017, 09:42 PM
  3. How to connect to an Oracle Database, run a script/get external data
    By thisguy4000 in forum Access Tables & Databases
    Replies: 3
    Last Post: 08-19-2014, 05:58 AM
  4. Connect to Oracle database on server. x64 Windows 7
    By steve87bg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 08:54 AM
  5. Unable to connect from excel to Oracle db from local
    By smlim7 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2013, 11:37 PM
  6. [SOLVED] code which will connect to Oracle DataBase
    By sawoodalam1989 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2013, 11:47 PM
  7. Connect to Oracle database using ODBC when opening worksheet
    By oteixeira in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-07-2007, 01:20 AM

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