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

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

Hi Prasad,
I have never experienced this problem, but after taking a quick look at the javadoc for some JDBC classes, I found something that may help. 
Try looking into the <i>setMaxRows</i> method on the <i>Statement</i> class.  The URL below will take you to the complete javadoc for this class, however, here is the part that I believe relates to your problem:
"...If the limit is exceeded, the excess rows are silently dropped." 
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html
If you are not setting this limit explicitly in your code, the JDBC driver implementation may be using some default value. 
Setting this value to zero means that there is no limit, so you may want to try that. 
Kind regards,
Mike

Similar Messages

  • JDBC-ResultSet and ArrayList

    Hi guys,
    I need a help. The situation is next: I�m trying to store some results of ResultSet into ArrayList. Unfortunately, when I�m retrieving the data from ArrayList, the result, which I�m getting, is only the last row of a table. The result is repeating as many times as ArrayList size is. Could somebody explain me why it happens?
    There is a snippet of the code to get a data from the ResultSet and add it into ArrayList:
    // Execute a query
    String sql = "select * from user";
              Statement stmt = conn.createStatement();
              ResultSet rs = stmt.executeQuery(sql);
              ArrayList list = new ArrayList();
              // Extract data from the result set
              while(rs.next()) {
    CustomerBean cb = new CustomerBean();
                   if(rs.getString("first_name")!=null)cb.setFirstName(rs.getString("first_name"));
                   if(rs.getString("last_name")!=null)cb.setLastName(rs.getString("last_name"));
                   if(rs.getDate("dob")!=null)cb.setDob(rs.getDate("dob"));
                   list.add(cb);
    Another snippet of the code to retrieve the data from ArrayList:
    for (int i = 0; i < cb.getUserData().size(); i++){
    System.out.println("First -"+((CustomerBean)cb.getUserData().get(i)).getFirstName()); // hire an error
    System.out.println("Last - "+((CustomerBean) cb.getUserData().get(i)).getLastName());// hire an error
    System.out.println("Dob - "+((CustomerBean) cb.getUserData().get(i)).getDob());// hire an error
    Thank you in advance

    One thing you should change is the multiple calls on the same column to retrieve the columns value from your results set. This can definately be problematic depending on the JDBC driver you're using.
    I might suggest something like this:
    // Execute a query
    String sql = "select * from user";
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    ArrayList list = new ArrayList();
    // Extract data from the result set
    while(rs.next()) {
    CustomerBean cb = new CustomerBean();
    String firstName = rs.getString( "first_name" );
    String lastName = rs.getString( "first_name" );
    Date dateOfBirth = rs.getDate( "dob" );
    if ( firstName != null )
       cb.setFirstName( firstName );
    if ( lastName != null )
       cb.setLastName( lastName );
    if ( dateOfBirth != null )
       cb.setDob( dateOfBirth );
    list.add( sb );
    for (int i = 0; i < list.size(); i++){
    System.out.println("First -"+((CustomerBean)list.get(i)).getFirstName()); // hire an error
    System.out.println("Last - "+((CustomerBean)list.get(i)).getLastName());// hire an error
    System.out.println("Dob - "+((CustomerBean)list.get(i)).getDob());// hire an error
    }Although this might not immediately solve your problem, it might help narrow down the area where the problem might exist.

  • My new downloaded camera raw 8.4 and DNG converter 8.4 are no different

    I've downloaded and installed camera raw 8.4 but when opened it's no change from camera raw 7.0 none of the new features are there.

    Thanks for your reply
    I've got window 7 and Photoshop CS6
    I've not tried Help>Updates but I'll go have a look
    I got the link http://www.adobe.com/support/downloads/details.jsp?ftpID+5739    from Adobe under their download links DNG Coverter 8.4
    and when I open camera raw it does say it is the 8.4 version but that is the only thing that has changed everything else is as it was.

  • Using objects rather than jdbc resultset to fill reports

    Hi buddies!
    I�m developing a small sample of application that generates reports using values retrieved from objects.
    The idea is simple, I have an arraylist of objects and want to fill my report which these objects atributes.
    Jasper Project API has a class called JasperFillManager which is used to fill reports and takes 3 arguments, for instance:
    JasperFillManager.fillReport(JasperReport reporttofill,HashMap parameters, JRDataSource dataSource)
    I�ve created a custom JRDataSource named fonteDadosJasperCustomizada
    This class implements an arraylist of objects and two methods from the interface JRDataSource which are responsible for giving the values to fill the report. This class doesn�t take values from a resultset! ;)
    but for some reason nothing appears to me after executing the application... everything is alright I think the might be a mistake in the interface methods, the report also is alright.
    All sugestions are welcome
    thanks
    import java.sql.*;
    import java.util.HashMap;
    import java.util.Map;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.view.JasperViewer;
    public class relatorioteste1{
         public relatorioteste1(){
         try{     
              fonteDadosJasperCustomizada fonte = new fonteDadosJasperCustomizada();
              JasperDesign relatoriocarregado = JRXmlLoader.load("c:/relatorioteste1.jrxml");          
              JasperReport relatoriocompilado = JasperCompileManager.compileReport(relatoriocarregado);
              /*the parameter fonte being passed to fillManager is a custom JRDataSource.
              * The default JRResultSetDataSource only receives a JDBC ResultSet and
              * extracts Data from it to fill the Report, such Object is implements
              * the JRDataSource interface which defines methods that are used by
              * fillManager to obtain data from the ResultSet.
              * My intention is to create my own JRDataSource class which should
              * be able to retrieve data from objects instead of ResultSet
              * See class fonteDadosJasperCustomizada for details
              JasperPrint relatorioimpresso = JasperFillManager.fillReport(relatoriocompilado,new HashMap(),fonte);
              JasperViewer.viewReport(relatorioimpresso);
         catch(Exception e){
              javax.swing.JOptionPane.showMessageDialog(null, e.getMessage());
         public static void main(String args[]){
              new relatorioteste1();
    import net.sf.jasperreports.engine.JRDataSource;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.JRField;
    import java.util.ArrayList;
    public class fonteDadosJasperCustomizada implements JRDataSource {
         public Object getFieldValue(JRField arg0) throws JRException{
         /*The following line returns the next object(aluno) from
         * the arraylist collection
              Aluno aluno = (Aluno) dados.listIterator().next();
         /*This block verifies which column value(field) is being
         * requested by the jasperFillManager.fillReport and returns
         * an object value corresponding to the field
              if ("codigo".equals(arg0.getName()))
                   return Integer.valueOf(aluno.getCodigo());
              else if ("nome".equals(arg0.getName()))
                   return aluno.getNome();
              else
                   return Integer.valueOf(aluno.getIdade());     
              public boolean next() throws JRException{
              /*this decision verifies if there�re more elements in
              * the arraylist collection if so returns true... else returns
              * false
              if (dados.listIterator().hasNext())
                   return true;
              else
                   return false;
         public fonteDadosJasperCustomizada(){
              /*The constructor of my custom JRResulSetDataSource should receive
              * a JDBC ResultSet in place of an Arraylist of Objects
              * The atributes of each object is mapped to a field in
              * jasperreports template
              dados = new ArrayList();
              dados.add(new Aluno(1,"charlles cuba",25));
              dados.add(new Aluno(2,"Maicom napolle",25));
              dados.add(new Aluno(3,"Gustavo castro",21));          
         public static void main(String args[]){
              new fonteDadosJasperCustomizada();
         ArrayList dados;     
    }

    Buddies thansk everyone
    I�m really grateful... the previous post in here was very useful to me. I
    was wrong about ArrayList.listIterator.
    I finnaly generated a report from an arraylist of objects.
    Here�s the code... I made some changes the first one was wrong
    HERE IS MY MAIN CLASS RESPONSIBLE FOR GENERATING THE REPORT
    public class relatorioteste1{     
         public relatorioteste1(){
              try{     
                   fonteDadosJasperCustomizada fonte = new fonteDadosJasperCustomizada();
                   JasperDesign relatoriocarregado = JRXmlLoader.load("c:/relatorioteste1.jrxml");          
                   JasperReport relatoriocompilado = JasperCompileManager.compileReport(relatoriocarregado);                    
                   JasperPrint relatorioimpresso = JasperFillManager.fillReport(relatoriocompilado,new HashMap(),fonte);
                   JasperViewer.viewReport(relatorioimpresso);
              catch(Exception e){
                   javax.swing.JOptionPane.showMessageDialog(null, e.getMessage());
         public static void main(String args[]){
              new relatorioteste1();
    HERE IS MY CUSTOM JRDATASOURCE
    public class fonteDadosJasperCustomizada implements JRDataSource {
         public Object getFieldValue(JRField arg0) throws JRException{     
              if ("codigo".equals(arg0.getName()))
                   return Integer.valueOf(aluno.getCodigo());
              else if ("nome".equals(arg0.getName()))
                   return aluno.getNome();
              else
                   return Integer.valueOf(aluno.getIdade());
         public boolean next() throws JRException{
              if (iterator.hasNext()){
                   aluno = (Aluno) iterator.next();                    
                   return true;
              else
                   return false;          
         public fonteDadosJasperCustomizada(){          
              dados = new ArrayList();
              dados.add(new Aluno(1,"charlles cuba",25));
              dados.add(new Aluno(2,"Maicom napolle",25));
              dados.add(new Aluno(3,"Gustavo castro",21));
              iterator = dados.listIterator();
         public static void main(String args[]){
              new fonteDadosJasperCustomizada();
         ArrayList dados;
         Iterator iterator;
         Aluno aluno;
    }

  • Wait events 'direct path write'  and 'direct path read'

    Hi,
    We have a query which is taking more that 2 min. It's a 9.2.0.7 database. We took the trace/tkprof of the query,and identified that there are so manay 'direct path write' and 'direct path read' wait events in the trace file.
    WAIT #3: nam='direct path write' ela= 5 p1=201 p2=70710 p3=15
    WAIT #3: nam='direct path read' ela= 170 p1=201 p2=71719 p3=15
    In the above, "p1=201" is a file_id, but we could not find any data file, temp file, control file with that id# 201.
    Can you please let us know what's "p1=201" here, how to identify the file which is causing the issue.
    Thanks
    Sravan

    What does:
    show parameter db_filesreturn? My guess, is that it returns 200.
    The direct file read and direct file write events are reads and writes to TEMP tablespace. In those wait events, the file# is reported as db_files+temp file id. So, 201 means temp file #1.
    Now, as to your actual performance problem.
    Without seeing the SQL and the corresponding execution plan, it's impossible to be sure. However, the most common causes of temp writes are sort operations and group by operations.
    If you decide to post your SQL and execution plan, please be sure to make it readable by formatting it. Information on how to do so can be found here.
    Hope that helps,
    -Mark
    Edited by: mbobak on May 1, 2011 1:50 AM

  • Disable Mouse and other Keys except Number and Directional keys in a screen

    Hi all,
    Recently we have developed a sceen program as per the requirements of client who are used to enter meter readings using only Enter key. They used to give Enter key to give meter readings, date of meter reading, meter reading note and consumption in their legacy system.
    Though we developed the screen as per the requirements with all validations checking simultaneously which are required but we failed to handle mouse and other keys as we have not found any specific events occured by the keys.
    Now some of the meter readers are using mouse and other keys and because of this our code is getting failed and no validations are working at all. So we want to disable the mouse and other keys except Number keys and Directional Keys while we are in the screen so that they are bound to work with the Enter and NumKeys as per their requirements.
    Please help me with an idea or code snippet by which we can solve the problem. <removed by moderator>
    - Arghya Das,
    <removed by moderator>
    Edited by: Thomas Zloch on Aug 10, 2011 12:46 PM

    Hi,
    Just go through this link, it would be helpful...
    [http://help-abap.blogspot.com/2008/10/alv-disable-delete-key-on-keyboard-in.html]
    <removed by moderator>
    Thank You,
    Regards
    Pradeep
    Edited by: Thomas Zloch on Aug 10, 2011 12:50 PM

  • Difference between copying cube content using datamarts and direct copying

    Hi Experts,
    I have been going through the SDN for the last 6 months  and this is my first post
    I know two methods of copying the cube content from one cube to another.
    One is data mart method in which we create a datasource based on the cube and
    then create a transformation between the new cube and datasource.
    This method is used if our source cube is in same server or in diff server.
    Other method is directly copying the cube content from source to destination
    by creating a transformation between two cubes .
    this is used if source cube anddestc u be are in same server.
    My  doubt is if both the cubes are in same server then what is diff between first method
    and second method,
    Please clarify me

    Hi,
    Now Iam closing this thread with a conclusion .
    The question is what is the difference between copying cube
    content using datamarts and direct copying
    Also what are there any other methods to copy cube contents
    from one cube to another.
    The  diff bet using data marts and direct copying is
    In case of datamarts,ven if the source cube is changed in futute there is no effect on the target cube.
    In case of copying directly,whenever the source cube is changed,the transformation becomes inactive.
    so we have to activate the transformation again.
    ALso there are some other methods to copy cube contents fron one to other .
    But datamarts is sap standard one.
    Thankyo every one for giving answers
    Regards,
    Sundar

  • What are the different Project Type Scenarios in SAP?

    hi experts,
    i am new to SAP,
    want to know how many types of SAP projects are there ?
    What is meant by Enhancement Projects ?
    if any info., helps me a lot to understand.
    thanks in advance
    sasi

    Hi anji,
    Good answer,
    GAP ANALYSIS:
    The gap analysis is the analysis on what the differences between actual system are and what the customer want to develop.
    A through gap analysis will identify the gaps between how the business operates ad its needs against what the package can can't do. For each gap there will be one of three outcomes which must be recorded and auctioned, GAP must be closed and customized software can be developed close the gap, GAP must be closed but software cannot be written therefore a workaround is required, GAP does not need to be closed.
    In simple terms: Gap means small cracks. In SAP world. In information technology, gap analysis is the study of the differences between two different information systems or applications( ex; existing system or legacy system with Client and new is SAP), often for the purpose of determining how to get from one state to a new state. A gap is sometimes spoken of as "the space between where we are and where we want to be." Gap analysis is undertaken as a means of bridging that space.
    Actual gap analysis is time consuming and it plays vital role in blue print stage.
    While implementing the SAP to one company they use ASAP Methodologies to implement it has 5 steps .
    1: project preparation .
    2: Business blue Print .
    3: Realization .
    4: Final preparation .
    5: Golive .
    in Business blue print they give AS IS and TOBE that means what are the different requirements are to be made to reach the customer requirement that is called Gap analysys
    Regards
    Suresh.D
    Message was edited by:
            suresh dameruppula

  • Difference between Realtime Data Acqisition and Direct Data Access ?

    Hi experts,
    What is RDA and DDA and whrere these two are used ?
    What is the Difference between Realtime Data Acqisition and Direct Data Access?
    Please explain me in a detail manner, i will assign points for ur valuable answers..............

    Hi,
    Eventhough the aim of the two methods are to report on the latest data, there is a difference in both.
    In Realtime Data Acqisition you are loading the data into BW and then reporting on that data from BW Infoproviders.
    http://help.sap.com/saphelp_nw04s/helpdata/en/52/777e403566c65de10000000a155106/content.htm
    I think you are refering to Virtual providers by the term Direct Data Access. In  Direct Data Access you are not loading data into BW. Data is residing in R/3 itself. Your reports will fetch data from R/3 directly. The data is called during execution of a query in the source system.
    http://help.sap.com/saphelp_nw04s/helpdata/en/23/c0234239f75733e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/EN/13/3e34429692b76be10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/da/5909392a430303e10000000a114084/frameset.htm
    Hope this helps.
    Thanks,
    JituK

  • How to I contact Apple about a support issue with Game Center--itself, directly. I changed my Apple ID and now I cannot access my game center account that I had previously. It created a new one for me with my new apple ID instead of keeping the old one.

    I want to submit an issue with Game Center--itself, directly. I had an account set up that I used to play online games. I changed my appleID and then I no longer could access my game center account. I, apparently, had a new game center account created for me (which is friends with my old account) and now I cannot access my original game center account.
    If I can't get access to email apple directly (which seems ridiculously difficult to do), then someone please tell me how to FIX the issue.
    Thank you

    Yes. I have tried that. When I use the ID I had before, it sets it up as a new account and I don't want to lose my stats attached to my old account.
    Let's say that my old nickname was "user10" and I used the email, "[email protected]" for my apple id. I changed my apple id to "[email protected]" and it changed my game center account to "mynew" and somehow I am friends with my old acct, "user10". I tried getting a password reset for "user10" but I apparently don't know my own birthday, which is possible because I usually give a false one, but the same false one each time.

  • How can I transfer photos from my comp to my ipad2.I have the connection kit and can transfer photos that are direct from camera BUT if I transfer photos from comp to card it will not recognize them ????

    how can I transfer photos from my comp to my ipad2.I have the connection kit and can transfer photos that are direct from camera BUT if I transfer photos from comp to card it will not recognize them ????

    To sync photos from a Mac or Windows PC to your device using photo applications
    Make sure you have the latest version of iTunes installed.
    In iTunes, select your device's icon in the Devices list on the left.
    Click the Photos tab.
    Choose "Sync photos from."
    On a Mac, choose iPhoto or Aperture from the pop-up menu.
    On a Windows PC, choose Photoshop Album or Photoshop Elements from the pop-up menu.
    Note: Some versions of Photoshop Album and Photoshop Elements don't support collections. You can still use them to sync all your photos.
    If you want to sync all your photos, enable the option for "All photos, albums, events, and faces." If you want to sync photos from only some albums, events, or faces, enable the option for "Selected albums, events, and faces" and then select the albums you want. If syncing on a Mac with iPhoto version 6.0.6 or later, you may enable the option to "Include videos" to sync videos directly from iPhoto to your device. (Requires iOS 3.0 or later).
    Click Apply.
    To sync photos from a folder on your hard disk to your device
    Drag the images you want into a folder on your computer. If you want images to appear in separate photo albums on your device, create folders inside the main folder and drag images into the new folders.
    In iTunes, select the device icon in the Devices list on the left.
    Choose "Sync photos from."
    Select Choose Folder from the pop-up menu and choose your main image folder.
    Click Apply.

  • HT1495 My Wife and I have separate accounts on the same Macbook Pro.  I have moved the iTunes library to a shared area and we can both access it, however, my Wife (secondary user)can't import cd's. Is there something we are missing and is there a way to d

    My Wife and I have separate accounts on the same Macbook Pro.  I have moved the iTunes library to a shared area and we can both access it, however, my Wife (secondary user)can't import cd's. Is there something we are missing and is there a way to do this?

    You are more likely to get relavant and useful suggestions posting to the Mac forums instead of the iTunes for Windows forum where you've posted.

  • Hi there, I pay for extra iCloud space online. However I cannot seem to find any of my photos or account? As my iPod/iPhone only hold 1000 pictures, where are the previous pictures? And how can I access them?

    Hi there, I pay for extra iCloud space online. However I cannot seem to find any of my photos or account? As my iPod/iPhone only hold 1000 pictures, where are the previous pictures? And how can I access them?

    You cannot use iCloud Storage to suppliment your iPad. They are mainly used to backup iPad.
    Free up space on iPad
    Settings>General>Usage>Storage>Delete what is not needed to free up space on iPad.

  • I have a 4s and I am not sure when it began, but I cannot save photos that are nit camera related in my photo roll. Furthermore, applications that I have downloaded and should request access are not apparent in my privacy photo settings. What should I do?

    My problem began when I wanted to change my screen saver.  At first, I would try to take pictures and download images and they would toatally disappear.  So then I uninstalled my icloud, deactivated my photostream, and supposedly restored my phone to the last back up.  Well atleast now the pictures that I take are not dissappearing into thin air.  However, I have never been able to and I still cant seem to turn on the request for photo applications in my privacy settings.  I am not sure when this initial problem began.  As of now, I am not able to save downloaded photos to my camera roll and applications that  request access to my photos are not displayed in my privacy settings to even accept the request. This is very frustrating and I am not sure what to do. 
    I have tried everything from disabling and enabling my icloud, disabling and enabling my photo stream, stopping the photo app and restarting it, and even restoring it to the last itunes backup.

    This works!
    go to settings> general>restrictions>privacy and allow changes.  Make sure that your camera is on under allow!

  • Windows network setup: can't share on network and have each system access internet directly

    Windows network setup would not let me set up my network so that I could both:see my other computers on the network and have them both connect directly to the internet. It wanted to set one up as a server.
    Is it dangerous to arrange it that way?
    If not, several people have told me it should be no problem to set up my network so that my computers can see each other and share, and yet still ahve access to the internet. I think this is enabled through DHCP?
    Would someone mind lending me a hand?
    I have a BEFW11S4v2
    Message Edited by DaveC426913 on 10-20-2007 09:23 PM

    you can try following the steps mentioned in this link

Maybe you are looking for

  • Is there a way to comunicate files on itunes with a external harddrive?

    I have a a large music library. I use itunes. All the files sit on my external drive. Is there a way (when I delete files on itunes) to have the files automatically deleted on the external drive? Also, I have heard about the duplicate file option, bu

  • The older version of bonjour

    User complained ITunes store not working on PC.  Itunes store would not open to show users apps or music. Uninstalled Itunes - and tried to reinstall Itunes, issue persisted. Unistalled, Itunes, Quicktime, Bonjour - "Error on install of Itunes now, t

  • Trying to re-open Photoshop 12

    I have spent the last two days trying to re-open this trial software that is Photoshop 12.  Not only am I not that impressed with the software to begin with, especially the graphics and ergonomics, but I've spent hours going in circles trying to re-o

  • Java.lang.ClassNotFoundException: oracle/webdb/provider/v2/adapter/soapV1/ProviderAda

    i am using tutorial "Building Java Portlets Using Oracle9i JDeveloper" from: "http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/ARTICLES/BUILD.JAVA.PORTLETS.USING.JDEVELOPER.V2.HTML " I recieve following error when i try to run this co

  • Oracle 8i on Windows 2003

    Hi Guru, WE have to do some POC on Oracle 8i, can you please me know whether Oracle 8i can install on Windows 2003 server. Thanks, Tippu