1. Jostein Ullestad
  2. PowerBuilder
  3. Thursday, 24 October 2024 10:01 AM UTC

Hi

 

We are attempting to connect to MSOLEDBSQL using an Access Token, but it is failing. We need some advice on this issue.

We have tried the following setups:

  • PowerBuilder 2022 R3 Build 3356
  • PowerBuilder 2025 Build 3398

 

We successfully accessed the database using a username and password, confirming that our program can reach the server.

However, when using the full access token (which is quite long), PowerBuilder terminates unexpectedly. It appears that there might be a limit on the length of the SQLCA.DBParm string.

 

  1. Is our code the correct approach?
  2. What could be done with what seems to be a size limit on DBParam?
  3. Any other approaches we could use?

 

Thank you

Jostein

 

Our Code:


String        ls_accessToken
String        ls_DBParm
transaction   lu_trans

ls_accessToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1N;"

ls_DBParm = "Database='<our database>',Provider='MSOLEDBSQL19',"
ls_DBParm+= "ProviderString='Access Token=" + ls_accessToken + ";"
ls_DBParm+= "Use Encryption for Data=Mandatory'"

lu_trans = CREATE transaction
lu_trans.DBMS = "MSOLEDBSQL SQL Server"
lu_trans.ServerName = "tcp:<our server>,1433"
lu_trans.AutoCommit = False
lu_trans.DBParm = ls_DBParm

CONNECT USING lu_trans;

// SQLErrText=
// SQLSTATE = 28000
// Microsoft OLE DB Driver 19 for SQL Server
// Login failed for user '<token-identified principal>'.

// SQLCode = -1
// SQLDbCode = 18456

 

Peter Pang @Appeon Accepted Answer Pending Moderation
  1. Friday, 25 October 2024 07:01 AM UTC
  2. PowerBuilder
  3. # 1

Hi Jostein,

Thanks for reporting this issue!
It seems to be an authentication method of MSOLEDBSQL:Microsoft Entra Managed Identity, which is not currently supported by PowerBuilder. You can first raise a request. I would suggest opening a support ticket: https://www.appeon.com/standardsupport/newbug.


It is worth considering. When the token expires, do you want to manually replace the new token, or do you want the driver to automatically refresh it?

 

Best Regards,
Peter

Comment
  1. Jostein Ullestad
  2. Friday, 25 October 2024 09:21 AM UTC
Thank you Peter.



Is there any possibility of expanding that DBParm length in the upcoming PowerBuilder 2025 and possibly for PowerBuilder 2022?



Rgs

Jostein
  1. Helpful
  1. Peter Pang @Appeon
  2. Friday, 25 October 2024 09:52 AM UTC
After some analysis, it is limited by the length of the registry subkey. We do not intend to take this risk. The correct approach is to support this authentication method from the source.
  1. Helpful
  1. Jostein Ullestad
  2. Friday, 25 October 2024 10:42 AM UTC
Thank you Peter

Could you please elaborate on which registry key you are referring to?

I'll make a separate request for PB 2025 to support this type of connection.

Rgs

Jostein
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 24 October 2024 15:40 PM UTC
  2. PowerBuilder
  3. # 2

Hi Jostein;

  I suspect that the SS DB driver is taking down the PB IDE or your App EXE as it runs as a "sub-task" to the "main task" which is either the PB IDE itself or your App EXE. If the sub-task crashes and does not perform a proper TRY..CATCH - then the O/S sees the failure but will penalize the "Main Task" for the sub-task's failure. Thus, the IDE and / or App EXE can just disappear leaving you with the only recourse of looking in the O/S's App Logs for more details as to the failure.

  As to why this is causing a crash should not be because the DBParm field is too long. It can hold up to 64K of string data. Now the next question could be "will the MSOLEDBSQL driver parse that correctly" would be a good subsequent question. As I do not have hands-on encryption use experience, I cannot say. Hopefully, someone else who has done this can jump in to enlighten us a bit more on its use.

Regards .. Chris

 

Comment
  1. Jostein Ullestad
  2. Friday, 25 October 2024 05:53 AM UTC
Thank you Chris.



The length of the full dbparm is 1388 long.

The error Windows indicates is BEX and refers to a Buffer Overflow Exception.



Windows event logger gives us this:



- Application Error

Faulting application name: PB250.exe, version: 25.0.0.3398, time stamp: 0x66f82715

Faulting module name: PBSHR.dll, version: 25.0.0.3398, time stamp: 0x66f8268d

Exception code: 0xc0000409

Fault offset: 0x0020b179

Faulting process id: 0x0x5180

Faulting application start time: 0x0x1DB26A0F68F7EF4

Faulting application path: C:\Program Files (x86)\Appeon\PowerBuilder 25.0\PB250.exe

Faulting module path: C:\Program Files (x86)\Appeon\Common\PowerBuilder\Runtime 25.0.0.3398\PBSHR.dll

Report Id: b48ad06f-05d5-44fa-a83f-4cf7c247bc88

Faulting package full name:

Faulting package-relative application ID:



- Windows Error Reporting

Fault bucket , type 0

Event Name: BEX

Response: Not available

Cab Id: 0



Problem signature:

P1: PB250.exe

P2: 25.0.0.3398

P3: 66f82715

P4: PBSHR.dll

P5: 25.0.0.3398

P6: 66f8268d

P7: 0020b179

P8: c0000409

P9: 00000008

P10:



- Windows Error Reporting

Fault bucket 0, type 5

Event Name: BEX

Response: Not available

Cab Id: 0



Problem signature:

P1: PB250.exe

P2: 25.0.0.3398

P3: 66f82715

P4: PBSHR.dll

P5: 25.0.0.3398

P6: 66f8268d

P7: 0020b179

P8: c0000409

P9: 00000008

P10:

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.