Skip to Content
0
Former Member
Dec 14, 2006 at 05:13 AM

JDBC ResultSet and direct D/B access are returning different no. of rows

26 Views

I am testing a JDBC application, which is using a DataSource definition configured in Visual Admin under JDBC Connector node.

This program gets the JDBC Connection via lookup thro' JNDIContext.

What is interesting is I am getting different no. of rows from ResultSet compared to direct execution in the Query Analyser.

SELECT DISTINCT IC.ship_to_num, IC.policy_type, IC.exp_date, IC.insurance_cert_id

FROM site_user SU

INNER JOIN user_bill_to UB ON SU.user_id = UB.user_id

INNER JOIN insurance_cert IC ON UB.ship_to_num = IC.ship_to_num

WHERE (DATEDIFF(dd, GETDATE(), IC.exp_date) <= 14)

AND (DATEDIFF(dd, GETDATE(), IC.exp_date) > 5)

AND IC.breaking_14_day_alert_date IS NULL

AND (SU.customer_id = 'dealer') AND (SU.is_owner = '1')

(3 in Qu.Analyser Vs. 0 from JDBC)

Or

SELECT * FROM message_target

(405 in Qu.Analyser Vs. 380 from JDBC)

I compared the JDBC program code results Vs. "DB Initialisation" tab result in Visual Admin tool Vs. Direct 'Query Analyser' of SQL Server results.

The programmatic JDBC results are equal to "DB Initialisation" tab results !

What is wrong here ?

Any help is greately appreciated.

Thanks,

Prasad Nutalapati