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

 

Who is viewing this page
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 24 October 2024 15:40 PM UTC
  2. PowerBuilder
  3. # 1

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
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.