PowerBuilder 11 “Invalid character value for cast specification”
I was given the task of migrating a set of powerbuilder applications from version 8 to 11.5.
The PowerBuilder applications required a database connection. I went through their connection utility and the only connection type that I could get to work with my Microsoft SQL Server 2000 was ODBC. I configured it and PowerBuilder told me that it was working properly. I configured all of the applications to use the ODBC.
All of the applications worked properly, except one: the only application that uses stored procedures. The stored procedures that were failing had input and output parameters. They kept giving me the error message of
[Microsoft][ODBC SQL Server Driver] Invalid character value for cast specification
I figured the problem was just a configuration issue. After extensive research, I found one forum that had a solution: adding
StripParmNames='Yes',CallEscape='No'
to the end of the DBParm. I tried this. It fixed the “Invalid character” problem, but then I started getting the following error message:
[Microsoft][ODBC SQL Server Driver] Incorrect syntax near 'OUTPUT'
Since everything seems to change when you tweak parameters, I tried every combination of parameters that I could see as possibly making a difference (both on the ODBC connection configuration and the DBParm settings).
Finally, I looked back at the original configuration and noticed that the DBMS was “MSS (Msoft) SQL Server 2000″. I started researching PowerBuilder database connection options and found this blog:
Mainly, that PowerBuilder’s native driver (MSS) had been removed from PowerBuilder version 10 and that PowerBuilder 11 replaced it with SNC to support SQL Server 2000 & 2005. Finally, I had found my solution. I switched my configuration to use the SNC driver and it solved all the problems I was having. Here’s the new configuration:
DBMS=SNC Database=<database name> ServerName=<server IP address> LogId=<db user name> LogPassword=<db password> Lock=RU DbParm=staticbind=0,Async=1,AppName='<app name>'