ADO "Unspecified Error" instead of actual error when fetching server side cursor

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-05-17T17:40:52Z Indexed on 2010/05/18 0:10 UTC
Read the original article Hit count: 271

Filed under:
|
|

This relates to my recent question: http://stackoverflow.com/questions/2835663/force-oracle-error-on-fetch

I am now able to reproduce a scenario where using ADO with the Oracle OLEDB Provider, I can force an error such as ORA-01722: invalid number to occur on calling Recordset.MoveNext However, this is not the error that is returned to the application. Instead, the application sees Provider error '80004005' Unspecified error. How can I get the application to see the real error from the database? This is with Oracle 10g (client and server), if it matters.

Sample code is roughly as follows:

Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As ADODB.Recordset

con.ConnectionString = "Provider=OraOLEDB.ORACLE;Data Source=xxx;User Id=yyy;Password=zzz"
con.CursorLocation = adUseServer
con.Open
Set cmd.ActiveConnection = con
cmd.CommandText = "select * from table(ret_err)"
cmd.Prepared = True
Set rs = cmd.Execute
While Not rs.EOF
  rs.MoveNext
Wend

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about ado