× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I figured out the problem. The resultset stayed emty, because the
library in wich the actual database stands is diffrent than the one I
gave up in the SQL. Sorry for the question, I was just thinking in the
wrong direction.

Thanks anyway,
Michiel

-----Oorspronkelijk bericht-----
Van: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] Namens Vengoal Chang
Verzonden: woensdag 31 augustus 2005 2:46
Aan: Java Programming on and around the iSeries / AS400
Onderwerp: Re: Empty resultset

How many members on aaa.Yrtpf ? If you use PF as data source, default is
*first member. So make sure you get the exact member, you can use
"create alias" to create specified member which you want get. Then
"select * from your-alias".

Best regards,

Vengoal



Mertens, Michiel ??:

>>Hello,
>>
>>I'm trying to get data out of an existing database. The database is 
>>created with SDA/ SUE. After the connection is and the query is 
>>excecuted, the resultset stays empty. When I try the same with a 
>>database I created with SQL it does return the values I requested.
>>
>>The questions I have are: 
>>*     Is there a difference if a database is created with SUE/ SDA or
>>with SQL.
>>*     And why does the resultset stay empty.
>>
>>The code I used is the following:
>>
>>package javaBenchmark;
>>import java.sql.*;
>>import java.util.Properties;
>>
>>public class DatabaseQuery
>>{
>>      private Connection connection = null;
>>      
>>      public static void main(String[] args)
>>      {
>>              long startConnectieTijd = System.currentTimeMillis();
>>              
>>              DatabaseQuery db = new DatabaseQuery();
>>              
>>              long startTijd = System.currentTimeMillis();
>>              
>>              db.runQuery();
>>                              
>>              long stopTijd = System.currentTimeMillis();
>>                                              
>>              System.out.println("Querytijd:  " + (stopTijd -
startTijd));
>>              System.out.println("Totaaltijd: " + (stopTijd - 
>>startConnectieTijd));
>>              
>>              db.cleanup();
>>      }
>>      
>>      public DatabaseQuery() 
>>      {
>>
>>                      
>>                      Properties properties = new Properties ();
>>                      properties.put("user", "...");
>>                      properties.put("password", "...");
>>
>>                      
>>                      try 
>>                      {
>>      
>>Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
>>                              connection =
>>DriverManager.getConnection("jdbc:db2:*local", properties);
>>
>>                      } catch (Exception e) {                         
>>                              System.out.println("Caught exception: "
>>+ e.getMessage());
>>                      }
>>              }
>>              
>>      public void runQuery() 
>>      {
>>                      try 
>>                      {
>>                              Statement s =
>>connection.createStatement();
>>                              // ResultSet rs = s.executeQuery("select
>>* from aaa.basicjdbc");
>>                              ResultSet rs = s.executeQuery("select *
from aaa.Yrtpf");
>>      
>>System.out.println("--------------------");
>>                              int i = 0;
>>                              while (rs.next()) {
>>                                      System.out.println("| " +
>>rs.getInt(1) + "|" + rs.getString(2) + "|" );
>>                                      i++;
>>                              }
>>      
>>System.out.println("--------------------");
>>                              System.out.println("There were " + i + "
>>rows returned.");
>>                              System.out.println("Output is
>>complete.");
>>                      } 
>>                      catch (SQLException e) 
>>                      {
>>                              System.out.println("SQLException
>>exception: ");
>>                              System.out.println("Message:....." +
e.getMessage());
>>                              System.out.println("SQLState:...." +
e.getSQLState());
>>                              System.out.println("Vendor Code:." +
e.getErrorCode());
>>                              e.printStackTrace();
>>                      }
>>              
>>              }
>>              
>>      public void cleanup() 
>>      {
>>               try 
>>               {
>>                      if (connection != null) connection.close();
>>               } 
>>               catch (Exception e) {
>>                         System.out.println("Caught exception: ");
>>                         e.printStackTrace();
>>                 }
>>       }
>>}
>>
>>I reckon the problem lies in the method runQuery. But I can't figure
>>out what it is.
>>ResultSet rs = s.executeQuery("select * from aaa.basicjdbc");
>>This statement returns the values I requested. It collects the data
>>from the database created with SQL.
>>
>>ResultSet rs = s.executeQuery("select * from aaa.Yrtpf");
>>This statement returns no values. It collects the data from the
>>existing database created with SUE/ SDA.
>>
>>Thanks,
>>Michiel
>>
>>
>>    
>>
>
>******************************************************************
>Deze e-mail is gecontroleerd op virussen.
>Aan de inhoud van dit bericht kunnen geen rechten ontleend worden.
>******************************************************************
>  
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.