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