+ Reply to Thread
Results 1 to 4 of 4

ODBC connection to an Oracle database

  1. #1
    Registered User
    Join Date
    09-15-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    19

    ODBC connection to an Oracle database

    I did this several years ago and can't remember how I did it.

    I am currently querying data from an Oracle database through MS Access and then passing it to Excel for the user to work. Not all users have MS Access so I would like to automate the data pull from Excel

    Database information:

    The DNS is: a150
    The Tables are:

    MFE.Items
    MFE.Vendors

    Sample SQL string would be:
    Please Login or Register  to view this content.
    I need help on the VBA code to setup the connection, run the SQL and put the data into the spreadsheet.

    Thx.
    Last edited by roli001; 11-15-2009 at 03:23 AM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: ODBC connection to an Oracle database

    Hello roli001,

    This link may help you with the connection string.
    www.connectionstrings.com
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-15-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: ODBC connection to an Oracle database

    Thx Leith.

    I solved by looking mostly through forum and playing around with the recommendations.

    Long story short. I first figured out how to link Excel to the database. Then how to pull the record set.

    I also had a problem where I copied the SQL from Access into VBA Excel and it took me some time to notice that the table names in Access had a format of ABC_TABLE_NAME, where in reality ABC was the server so the name in the Excel SQL was ABC.TABLE_NAME.

    Tested and working OK now.

    If it helps anyone here is the code (The SQL statement is in Sheet(2)):

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-26-2004
    Location
    Portland, Oregon
    MS-Off Ver
    Excel in Windows
    Posts
    49

    Re: ODBC connection to an Oracle database

    Thanks for posting your solution; too many people don't do this and thus their post fails to educate and help others.
    ~Toby

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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