Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

Sometimes I get this error in my PowerBuilder Application connected to a Sql Anywhere 12 database. It happens anywhere and sporadically when the application is retrieving data ( Select .. from .. where ... ). IN 90% of the situations the users are running any report.

Also. Sometimes the Error Message doesn't display and the report displays the first row multiple times..

Environment: PowerBuilder 10 ( client ). DataBase Sql Anywehere 10

Error Message displays the following: A database Error has occurred DataBase Error Code 999 Database Error Message: Select Error: An invalid handle was passed in a call to the database driver.

Your help is greatly appreciated.


asked 23 Jun '17, 15:03

rfalagan's gravatar image

accept rate: 0%

This is a PowerBuilder error. You may want to ask this in a PowerBuilder focused forum such as

permanent link

answered 26 Jun '17, 10:26

Chris%20Keating's gravatar image

Chris Keating
accept rate: 32%

edited 26 Jun '17, 13:02

Thanks for your reply although I think it is exactly the opposite. It is not a Pb error but a database issue.

By the way. The url you attached does not exists. Most likely because pb is no longer supported by sap.

(26 Jun '17, 12:45) rfalagan

I have corrected the link. My understanding is that PB 12.6 will continue to be supported into 2018.

This is not a database issue but a PowerBuilder issue. The misleading error text suggests a database issue but in fact the 999 error is reported when PowerBuilder is encountering an error which is not coming back from a database (connection) but in the context of a database request. For example, The 'DBMS is not support' type error is reported as an 999 because PB is not able to load its own database driver library without some error.

There are some threads which suggest that PB can report the "invalid handle" error if there is code in the retrieverow event that interacts with the database.

If you still believe that this is a database issue, you may want to enable request level logging. You can enable request logging by executing the following:

call sa_server_option('RequestLogging','sql'); call sa_server_option('RequestLogFile','<filespec>');

To disable, execute:

call sa_server_option('RequestLogging','none'); call sa_server_option('RequestLogFile','');

The request log should show if specific statements are making it to the server and if there are errors being returned. You should couple that with running with the PowerBuilder database trace enabled i.e., sqlca.DBMS="TRACE ODBC", so that you can see what PB sent vs what SA received.

(26 Jun '17, 13:48) Chris Keating

I'm aware of that thread about code in the retrieverow event.. I have no code at all in the retrieverow event.


(29 Jun '17, 10:55) rfalagan

In the future, please copy and paste the exact error message. If you type them in by hand, you will make misteaks like typing "was was" which greatly inhibits Google searching...

...which is what you should do; for example: "An invalid handle was passed in a call to the database"

permanent link

answered 26 Jun '17, 10:43

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

edited 26 Jun '17, 10:47

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 23 Jun '17, 15:03

question was seen: 4,629 times

last updated: 29 Jun '17, 10:55