Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB / Excel connection to Oracle

Options
  • 10-02-2004 1:40pm
    #1
    Registered Users 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,688 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 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