- Berka Frenfert
- PowerBuilder
- Wednesday, 1 February 2023 01:40 PM UTC
I connect to SQLServer with ODBC 18 in login window.
I retrieve a report that takes long time.
I terminate connection from server side.
I get message on the client side that communication link is broken.
I wrote code for the retrieve button so that it should check connection every time. So to check communication the simplest idea that came to my mind was Connect statement that runs every time retrieve button is clicked.
I click on retrieve button and i get message that Transaction already connected but that is okay and retrieve starts.
I terminate session from server side while retrieve was in progress and my app shows message communication link failure and retrieve is stopped. That is also okay.
I click on retrieve button again but this time as i know connection is broken already so Connect statement should return me zero because there is no connection. But i get negative SQLCODE -1 which as i believe is wrong. I expect that Connect statement will return zero and connection will be made again but that does not happen.
So i think transaction object SQLCA has no clue when the connection was broken or if it had the information then transaction object is not setting some flag that indicate broken link.
I don't know how it showed me communication link failure while my attempt to reconnect with Connect statement never succeeded after i terminated the process on server side.
I close application and restart it and then open report and retrieve it then it works fine. The problem with this process is that the login has to do every thing that is required for connection. But I want to reconnect with DB on retrieve button instead of opening login window again. The problem i think is that if transaction object is not destroyed after communication link failure then Connect statement does not work properly.
So first thing how do i know there is communication link failure while connect statement always return -1 on retrieve button? (login window issued 1st run of Connect; )
So what you might suggest me to look into or do to get transaction object back online again with connect statement?
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.