on 08-12-2015 9:44 AM
I've contracted my development application and database out to a developer to do some extraneous work. However, when testing the application in the developer's environment, datastore retrievals and embedded SQL do not return all the data - it's as if the SQL is only retrieving a small sub-set of data.
I've used Team Viewer to test the retrieved data in the developer's environment. What SQL works fine in PowerBuilder's ISQL will only return a subset in the application.
For example, a retrieve in ISQL using SQL code copied from a datastore returned an expected 112 rows but only 12 via the datastore when debugging the application. Doing a SELECT MAX(id) in imbedded SQL returned 12 whereas the code in ISQL retuned a correct 668. Embedded SQL used to retrieve string values returned NULL although the values sought were towards the end of the tables - that's if the SQL only searched early rows of the table.
Neither I nor the developer have encountered such a problem. We're both using PB 12.5.2, Windows 8.1, and MS SQLServer - version 2008 in my case (not sure of the developer's version).
Is this issue happening only on one specific table or with other tables as well?
If on only one specific table, I would suggest retrieving one row at a time and see which row is preventing the retrieval to continue. It appears to me that there is a data with a strange character and when the datawindow encounters that character, it stops the retrieval.
This kind of thing happened to me quite a while ago and all I did was update the data to remove the 'strange' character and the problem was solved. That character might not be visible to you. It's worth a try in my opinion.
Be sure to backup your data first.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Neil,
It happens with several tables - I can't say which tables it doesn't fail on. So I doubt whether it is caused by data with strange characters. Tried, road-tested, and working Embedded SQL in my environment fails to correctly SELECT when running the application in the developer's environment.
But the copied SQL performs perfectly well in ISQL in the developer's environment on the same DB.
One simple basic value that fails to SELECT from within the application is 'ADMIN' from a staff table.
In this respect, in my environment, SQL SELECT is case-insensitive - will return 'ADMIN', admin', 'Admin'. I confess to not knowing enough about MS SQL Server to know whether there can be a setting for case sensitivity. But I doubt whether this is an issue as there are failures on numeric values as well as varchar. For example, SELECT MAX(key_value) FROM ....; Such a call within the app may return, say, 26, but the same SQL in ISQL will return a correct value of 646.
William,
Based on all the input you've provided so far I think of only three possible causes for this problem:
1) The database connection parameters are different between the IDE and the running application. If these were exactly the same then this shouldn't be the cause, but you can check the database connection syntax on the preview tab of the database profile setup against the one used by the application to be sure they are so, including the LogId parameter.
2) The PB dlls used to access the database from the IDE are different than the ones used when running the application. I don’t know if this is possible but if the behavior is different inside the IDE than when running the application then it’s worth checking. By the way, I assume you are running the application within the IDE and not as a standalone application. If on the other hand you are running the application using the runtime dlls then this is more worth checking to be sure it is not using different versions of PB dlls (e.g. 12.5 or 12.5.1 against 12.5.2) which have the same name. Or maybe you are deploying the application as “32-bit or 64-bit” or “64-bit” modes while the IDE runs in 32-bit mode and this might use different dlls or in a different way. Maybe other members of this forum can help as we work only with version 12.5 and 64-bit deployment was introduced in version 12.5.1.
3) The running application executes tasks before the retrievals that consume memory which then restricts the amount of data retrieved in the datawindow. To check this, I’d suggest you create a single datawindow and place it inside a single window in a new empty application and try. This will reduce the amount of memory needed to run the application and it might now get the complete result set.
Regards,
Ricardo
Hi,
Can you test your application on Windows 7 ?
PB 12.5.2 was not tested with Windows 8.1.
There is a known issue with PB 12.6 on Windows 8.1 when using AdoResultSet.
This problem was fixed for PB 12.6 only.
Regards.
Abdallah.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Abdallah,
Unfortunately I don't have access to the developer's environment. I've asked him to visit this forum to see the responses kindly offered, which I know he has. I also asked him to respond directly to the advice given. He has not done the latter, nor do I know how much latitude he has as an employee to spend time testing.
Hey Bill,
Maybe there is an inadvertent filter on the datastore...
Does the where clause have dates?
Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good to hear from you, Lars.
No filters involved - as mentioned above, the problem occurs with a variety of tables, with a variety of embedded SQL, and with at least one datastore.
By way of example, the application, on booting, checks a whole raft of tables to update them programmatically with lookup data or additions to drop-down lists tables etc.
The respective SQL checks to see if the value exists, usually by embedded SQL, and if the value in question is not retrieved/selected, following SQL code adds the new, and ostensibly missing, value.
This adding of the 'new' values results in a series of DB errors, such as duplicate keys, as the application attempts to add values which already exists.
This in turn indicates that a different database is not being accessed.
Thanks again for the advice. Because I do not have access to the developer's machine, I've contacted him and asked him to assess the recommendations kindly made, and provide feedback.
I can answer some questions. First I do not believe it is a 'retrieve as needed' problem because the problem exists with embedded sql with a single SELECT, as well as with datastores, and probably datawindows - we didn't get that far into the application to test datawindows.
Nor do this think it a miss-match in dw column lengths to corresponding columns in the DB as the development application and DB are exactly the same as the one I develop in, and that runs fine - but it is interesting this caused a like problem. This goes for 'retrieve as needed' settings in datastores/datawindows.
As for being connected to another DB, I've yet to get an assurance back from the developer but a screen shot I saw with the staff table opened in MS SQL Server had all required staff details. But the application failed to retrieve an existing User Name via embedded SQL. The User Name retrieved with the copied SQL when run in ISQL.
I am confident the developer set the DBMS as SNC as he copied my registry settings. It seemed he used ADO.NET in the PowerBuilder connection profile, and had to use a UID and PWD in the registry settings (not required in my configuration with trusted connection) to connect to his server, which housed the DB. This would have resulted in different connection profiles in the application to that in PB - but he said he tried SNC instead of ADO.NET and the problem remained.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
William Beale wrote:
It seemed he used ADO.NET in the PowerBuilder connection profile, and had to use a UID and PWD in the registry settings (not required in my configuration with trusted connection) to connect to his server, which housed the DB.
Maybe it is a row level security issue if the developer and you are connecting with different users!? (different permissions -> different results)
Thanks Ricardo,
Because my DB contains heaps of look-up tables (drop-down list data, tables for data validation such as given and surnames, postcodes, country names, state names, etc) I provided my complete DB file and log, as well as my source code for the application. We are both working on Windows 8.
Stated differently, our working environments are essentially identical although I'm not sure of his MS SQL Server version. Mine is 2008 so he may have migrated my DB to a later version.
Is the Retrieve.AsNeeded property in the DW enabled (either in the DW Painter or via code)?
DW Painter: Menu > Rows > Retrieve Options > Rows As Needed
dw_1.Object.DataWindow.Retrieve.AsNeeded = "Yes" // or...via dw_1.Modify
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
do a select count(*) in embedded sql in the app with the table that has 112 rows.
if it doesn't return the number of expected rows, then it has to be that the database is either corrupted or a different one than what you think it is.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I once had the exact same problem. Here's what I discovered: when I originally created the DW, one of the string columns was 100 character long. Then that column was changed in the DB to 1000 characters. My application suddenly no longer retrieved all the rows. I simply opened the DW in source edit and changed "type=char(100)" to "type=char(1000)". Since then, I always make sure my DWs are in synch with the DB.
Hi William;
FWIW: Your description of the problem seems to me that the application is somehow connecting to a different instance of SQL Server and/or the database for this to happen. The only other possibility might be a different version of SS which has a DML parsing bug.
BTW: How are you and the application connecting to the DBMS (ie: OLE-DB, ADO.Net, ODBC, SNC, etc)?
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the next step then would be to use a PB SQL trace.
For example:
SQLCA.DBMS = "TRACE SNC"
- or -
SQLCA.DBMS = "TRACE ADO.Net"
Then in the SQL trace, check:
a) SQLCA connection information
b) DML being sent from the in-line SQL
c) result set coming back & return codes.
Now compare that to a trace where the inline SQL works as expected and look for discrepancies.
Try doing a database trace by putting 'TRA ' at the beginning of sqlca.DBMS. All SQL statements will be written to a file.
Then open the file in Notepad and you can see what SQL statements were executed and what the results were.
My guess is that it is connecting to a different database than you expected.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Rene, Roland,
I did check the PB connection process, and the registry settings all appeared as though I was connecting to the one DB. Moreover, there would be no point for the developer to create a second DB and empty it.
I gather it not a PB problem beyond some DB connection DB parameter.
Are you shure that you use the same database and the same schema in ISQL and application.
I do not think that this is a problem with powerbuilder.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.