1. Raymond Longoria
  2. PowerBuilder
  3. Wednesday, 6 January 2021 00:13 AM UTC

I just migrated a PB app from 8.0 to 2019 R2 with no errors. We are also moving from Sql Server 2008 to 2016. When testing the application against Sql Server 2016, I get the sqlca error "Mismatch between retrieve columns and fetch columns" on the first sql query. I compared the variables and db columns and they were fine. There were no db connection errors. The following is the sql and my db connection parms:

SELECT ACCESS_APP.Version, MessageToUsers, Displaymessageuntil
INTO :ls_appVersion, :ls_msgToUsers, :ldt_msgExpires
FROM ACCESS_APP
WHERE ACCESS_APP.app_name = :p_s_app_task ;

 

sqlca.DBMS = "SNC SQL Native Client(OLE DB)"   //used to be "MSS Microsoft SQL Server"

sqlca.dbparm = "OJSYNTAX='ANSI'"

 

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 6 January 2021 01:23 AM UTC
  2. PowerBuilder
  3. # Permalink

Greetings, Raymond - 

What DBParm string/settings did your PB 8 app use with the MSS driver?

Regards, John

Comment
  1. Raymond Longoria
  2. Wednesday, 6 January 2021 16:27 PM UTC
sqlca.DBMS = "MSS Microsoft SQL Server"

sqlca.database = sle_database.Text

sqlca.servername = sle_server.Text

sqlca.dbparm = sle_dbparm.Text

sqlca.dbparm = "OJSYNTAX='ANSI'"



sqlca.logid = sle_userid.Text

sqlca.logpass = sle_dbpass.Text

sqlca.userid = sle_userid.Text

sqlca.dbpass = sle_dbpass.Text
  1. Helpful
  1. John Fauss
  2. Wednesday, 6 January 2021 16:47 PM UTC
Here's what I use for the SQLCA properties with the SNC driver (some values are masked here):



SQLCA.DBMS = "SNC"

SQLCA.ServerName = "xxxxxxx\xxxxxx"

SQLCA.AutoCommit = False

SQLCA.DBParm = "Database='xxxxxx',Provider='SQLNCLI11',TrimSpaces=1,DateFormat='mm/dd/yyyy',TimeFormat='hh:mm:ss'"



TrimSpaces=1 trims trailing spaces from CHAR data. ANSI outer join syntax is the default, so no need to specify it. We turn AutoCommit off. We explicitly set the date and time formats. The SQLNCLI11 provider is for use with SQL Server 2012 and later (we are using SS2017).



Since I'm not familiar with your application, I cannot recommend any particular settings, but you might wish to experiment with some of these values, particularly the Date and Time format settings and the Provider setting. Let us know how it goes.



  1. Helpful
  1. Raymond Longoria
  2. Wednesday, 6 January 2021 23:50 PM UTC
John,

I added the parms you had in the DBParm string and it worked! Thank you very much for your help!
  1. Helpful
There are no comments made yet.
Pete Yankovich Accepted Answer Pending Moderation
  1. Friday, 9 April 2021 16:23 PM UTC
  2. PowerBuilder
  3. # 1

I'm also getting the "Mismatch between retrieve columns and fetch columns" error when calling a sql server proc with output parm. These are the particulars:

PB 2017 R2

See attached for SQL Server specs

It's important to note that the PB app has other stored proc calls with same format as this call and they work fine.

PB Code:

Var li_update is integer

// Run the stored proc to reprocess if update was successful.
// The proc returns 1 for success and 0 for failure in OUTPUT parm.
// The proc does its own transaction processing.
DECLARE ap_Meter_Ticket_Process PROCEDURE FOR dbo.ap_Meter_Ticket_Process
@IsReprocess = :ls_fl_reprocess,
@Id_user = :ls_id_user,
@rtn = :li_update OUTPUT;

EXECUTE ap_Meter_Ticket_Process;

if sqlca.sqlcode = 0 then
// Retrieve proc return code
FETCH ap_Meter_Ticket_Process INTO :li_update;

if sqlca.sqlcode <> 0 then
// Fetch Failure
li_update = -1
ls_sql_msg = sqlca.sqlerrtext
else
// Fetch Success
if li_update = 0 then
// Reprocess failed
ls_sql_msg = "Refer to email for failure details"
end if
end if
else
li_update = -1
ls_sql_msg = sqlca.sqlerrtext
end if

CLOSE ap_Meter_Ticket_Process;

SQL Server Code:

All parms have a default value as the proc is called from a SQL Agent job without parms

Var @rtn defaults to 1 for success and if the proc encounters any error situations, @rtn gets set to 0 for failure

ALTER proc [dbo].[ap_Meter_Ticket_Process]
(
@IsReprocess varchar(1) = 'N',
@Id_user varchar(30) = 'NONE',
@rtn int = 1 OUTPUT
)

Any help is appreciated

Pete

Attachments (1)
Comment
  1. Miguel Leeuwe
  2. Friday, 9 April 2021 16:48 PM UTC
Hi Pete

I think you'll get more answers if you make a new Q&A for your case.

regards
  1. Helpful
  1. Pete Yankovich
  2. Friday, 9 April 2021 17:01 PM UTC
Done - thanks
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 6 January 2021 22:52 PM UTC
  2. PowerBuilder
  3. # 2

Ask your DBA to check your SQL Server Login properties, General Tab, at the bottom you will see the default database assignment for the Login:

FYI - In our commercial application, we ALWAYS explicitly preface table names with "dbo." in DataWindow SELECT statements, embedded SQL, triggers, stored procedures, views, etc.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 6 January 2021 00:40 AM UTC
  2. PowerBuilder
  3. # 3

Hi Raymond;

   Yes, Microsoft's MSS and SNC DB Client's are a bit different technically under the hood. I suspect that it's the DW that's performing the update where the "Update Property" setting is conflicting against SS's locking mechanism. I would suggest looking at the table being updated and the column definitions used for the primary key and unique index columns that could be creating the DML error.

Regards ... Chris

Comment
  1. Raymond Longoria
  2. Wednesday, 6 January 2021 16:50 PM UTC
Actually this is embedded code and it is the first query the application does upon opening. I reviewed the columns in the table and did not see anything out of the ordinary.

  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.