Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB / Excel connection to Oracle

  • 10-02-2004 01:40PM
    #1
    Registered Users, Registered Users 2 Posts: 581 ✭✭✭


    Has anyone sample code for connecting Excel to an Oracle database using VB?

    I'm currently using the following code, but it's giving "ORA-01017: invalid username/password" error.

    Dim objConn As ADODB.Connection
    Dim objComm As ADODB.Command

    Set objConn = New ADODB.Connection
    Set objComm = New ADODB.Command

    objConn.ConnectionString = "Provider=MSDAORA;" & _
    "Driver={Microsoft ODBC for Oracle};" & _
    "SERVER=dw92;UID=olapsys;PWD=olapsys;"

    objConn.Open

    objComm.ActiveConnection = objConn
    objComm.CommandText = "UPDATE sh.countries SET country_name = 'Saudi'"
    objComm.CommandType = adCmdText

    objComm.Execute lngRecs

    MsgBox lngRecs & " records have been updated."

    objConn.Close


Comments

  • Moderators, Society & Culture Moderators Posts: 2,687 Mod ✭✭✭✭Morpheus


    Probably wrong here, i use SQL server and access, but you might double check the security/permissions that you have to the database.

    im not sure how u do that in oracle, but im talking about going into the oracle DB and looking for your username and password and ensuring they have access rights to the database data.


  • Registered Users, Registered Users 2 Posts: 581 ✭✭✭bazman


    The username & password I'm using works fine when connecting to the database using any other tool - it's only in Excel that I have a problem?

    Any ideas?


Advertisement