× 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.



Thanks Dave...

-----Original Message-----
From: Dave Wall [mailto:dawall@us.ibm.com]
Sent: Tuesday, May 21, 2002 6:06 PM
To: java400-l@midrange.com
Subject: RE: Custom Table Model.


You will have to import JTOpen 3.0 into VAJ.  VAJ will display errors when
importing because JTOpen 3.0 has support for JDBC 3.0.  VAJ will complain
when you import because it won't be able to find classes to resolve
references to the JDBC 3.0 classes.

I have one alternative.  You could do something like

// initialize rowCount to be -1
public int getRowCount()
{
   if (rowCount < 0)
   try
   {
      getResultSet().beforeFirst();
      rowCount = 0;
      while (getResultSet().next())
         rowCount++;
   }
   return rowCount;
}

That is, cycle through the rows until you run out, then return the count.
You don't seem to worry about preserving the cursor position in this method
so this should work.

I suggest this only because putting a new version of Toolbox in ET400 can
be painful.  VAJ is a great tool, but it is not very flexible.  If VAJ
doesn't like something (like missing references) it can be a pain about
letting you move forward.  If you do something like the above you should
switch back to doing getRow() when you can easily move up to JTOpen 3.0.

David Wall
Toolbox for Java
iSeries ODBC Driver for Linux




                      "Mangavalli,
                      Ramanujam"               To:
"'java400-l@midrange.com'" <java400-l@midrange.com>
                      <RamM@Mvmills.com        cc:
                      >                        Subject:  RE: Custom Table
Model.
                      Sent by:
                      java400-l-admin@m
                      idrange.com


                      05/21/2002 01:48
                      PM
                      Please respond to
                      java400-l





Dave,

I was using the ET400 tool in VAJ.

I have not used JTOpen. Do I need to import JTOpen into VAJ and set my
class
path? If not, can you please point me in the right direction?

Thanks.

-----Original Message-----
From: Dave Wall [mailto:dawall@us.ibm.com]
Sent: Tuesday, May 21, 2002 2:23 PM
To: java400-l@midrange.com
Subject: RE: Custom Table Model.



Sure looks like the getRow problem.  Did you try running your test with
JTOpen 3.0?

David Wall
Toolbox for Java
iSeries ODBC Driver for Linux




                      "Mangavalli,
                      Ramanujam"               To:
"'java400-l@midrange.com'" <java400-l@midrange.com>
                      <RamM@Mvmills.com        cc:
                      >                        Subject:  RE: Custom Table
Model.
                      Sent by:
                      java400-l-admin@m
                      idrange.com


                      05/21/2002 09:54
                      AM
                      Please respond to
                      java400-l





I am using the AS400JDBCDriver(). The system property is set to an AS400
object. Using the connect() method to obtain the connection.
After the connection is made, here is the code:

Statement SQLStatement =
getJDBCConnectionObject().createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet resultSet =
SQLStatement.executeQuery(getJEditorPane1().getSelectedText());
                                     ResultSetTableModel  ScrollRSModel =
new
ResultSetTableModel(resultSet);

System.out.println(ScrollRSModel.getRowCount());
-----Original Message-----
From: Dave Wall [mailto:dawall@us.ibm.com]
Sent: Tuesday, May 21, 2002 10:38 AM
To: java400-l@midrange.com
Subject: RE: Custom Table Model.


I see your code contains
   getResultSet().last();
   return getResultSet().getRow();

What JDBC driver are you using?  The Toolbox JDBC driver does not support
getRow() after a cursor movement based on the end of the result set (like
last()) until JTOpen 3.0 / V5R2.

David Wall
Toolbox for Java
iSeries ODBC Driver for Linux




                      "Mangavalli,
                      Ramanujam"               To:
"'java400-l@midrange.com'" <java400-l@midrange.com>
                      <RamM@Mvmills.com        cc:
                      >                        Subject:  RE: Custom Table
Model.
                      Sent by:
                      java400-l-admin@m
                      idrange.com


                      05/21/2002 09:19
                      AM
                      Please respond to
                      java400-l





Well, here is the code:
(getRowCount() returns 0).
public class ResultSetTableModel extends AbstractTableModel {
             private java.sql.ResultSet lResultSet;
             private java.sql.ResultSetMetaData lResultSetMetaData;
             protected final java.lang.String className
= "ResultSetTableModel";
/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:12:05 PM)
 * @param pResultSet java.sql.ResultSet
 */
public ResultSetTableModel(ResultSet pResultSet)
{
             setResultSet(pResultSet);

             try         {
                                     lResultSetMetaData =
lResultSet.getMetaData();
                         }
             catch (Throwable thrownException)
                                     {
                                     System.out.println("Error occurred in
class " +
className + " in constructor.\n");

thrownException.printStackTrace();
                                     }

}

/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:31:24 PM)
 * @return int
 */
public int getColumnCount()
{
             try         {
                                                 return
lResultSetMetaData.getColumnCount();
                                     }
             catch (Throwable thrownException)
                                     {

System.out.println(thrownException.getMessage());
                                                 System.out.println("Error
occurred in class
name " + className + " in method getColumnCount()");
                                                 return 0;
                                     }

}
/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:21:03 PM)
 * @return java.lang.String
 * @param pColumnNumber int
 */
public String getColumnName(int pColumnNumber)
{
             try
                         {
                                                 return
lResultSetMetaData.getColumnName(pColumnNumber + 1);
                         }
             catch(Throwable thrownException)
                         {

System.out.println(thrownException.getMessage());
                                     System.out.println("Error occurred in
class name " +
className + " in method getColumnName(int pColumnNumber");
                                     return new
Integer(pColumnNumber).toString();
                         }

}
/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:19:18 PM)
 * @return java.sql.ResultSetMetaData
 */
protected java.sql.ResultSetMetaData getLResultSetMetaData() {
             return lResultSetMetaData;
}
/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:18:40 PM)
 * @return java.sql.ResultSet
 */
protected java.sql.ResultSet getResultSet() {
             return lResultSet;
}
/**
 * getRowCount method comment.
 */
public int getRowCount()
{
             try
                         {
                                     getResultSet().last();
                                     return getResultSet().getRow();
                         }

             catch (Throwable thrownException)
                         {

System.out.println(thrownException.getMessage());
                                     System.out.println("Error occurred in
class name
ScrollableResultSetTableModel in method getValueAt()");
                                     thrownException.printStackTrace();
                         }

             return 0;
}
/**
 * getValueAt method comment.
 */
public Object getValueAt(int pRow, int pColumn)
{
             try
             {
                         ResultSet lScrollableResultSet =getResultSet();
                         //lScrollableResultSet.absolute(pRow + 1);
                         lScrollableResultSet.next();

System.out.println((String)lScrollableResultSet.getObject(pColumn+1));
                         return lScrollableResultSet.getObject(pColumn+1);

             }
             catch (Throwable thrownException)
             {
                         System.out.println(thrownException.getMessage());
                         System.out.println("Error occurred in class name
ScrollableResultSetTableModel in method getValueAt()");
                         System.out.println("Parameters passed to method
are row = "
+ pRow + ", column = " + pColumn);
                         thrownException.printStackTrace();
                         return null;
             }

}
/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:18:40 PM)
 * @param newLResultSet java.sql.ResultSet
 */
protected void setResultSet(java.sql.ResultSet newLResultSet) {
             lResultSet = newLResultSet;
}
/**
 * Insert the method's description here.
 * Creation date: (5/17/2002 2:19:18 PM)
 * @param newLResultSetMetaData java.sql.ResultSetMetaData
 */
protected void setResultSetMetaData(java.sql.ResultSetMetaData
newLResultSetMetaData)
{
             lResultSetMetaData = newLResultSetMetaData;
}
}


_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.






_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.






_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.






_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


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.