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.
- Is our code the correct approach?
- What could be done with what seems to be a size limit on DBParam?
- 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