Re: Copying from Result Set to Array List

2009-07-16 Thread Rahul
hi thanks a lot you guys its started working :) On Jul 16, 10:42 am, Sean wrote: > You can simplify that a lot by just doing: > String firstResult = result.get(0); > > You have a lot of conversions that are uncessceary. > > But judging by the error you're str has no elements in it. What you > wa

Re: Copying from Result Set to Array List

2009-07-16 Thread Sean
You can simplify that a lot by just doing: String firstResult = result.get(0); You have a lot of conversions that are uncessceary. But judging by the error you're str has no elements in it. What you want to check is result.size() > 0 On Jul 16, 10:05 am, Rahul wrote: > Hi, > Thanks for the r

Re: Copying from Result Set to Array List

2009-07-16 Thread Rahul
Hi, Thanks for the reply. I have changed the following things you asked me to do. This is the code of my onSuceess Method public void onSuccess(ArrayList result) { // TODO Auto-generated method stub

Re: Copying from Result Set to Array List

2009-07-16 Thread Sean
In all places you reference your callback, including the Async Interface, make it's AsyncCallback> callback and NOT: AsyncCallback< callback On Jul 15, 6:52 pm, Chad wrote: > Well, just that. The code you originally posted showed you trying to > retrieve integer data from your result se

Re: Copying from Result Set to Array List

2009-07-15 Thread Chad
Well, just that. The code you originally posted showed you trying to retrieve integer data from your result set, but your table contains string type data so your code wouldn't have worked. Now, the error you posted looks like you are trying to cast your result to a String in your onSuccess method.

Re: Copying from Result Set to Array List

2009-07-15 Thread Rahul
Hi Sean, Thanks for replying. I understood what you are trying to say. @Chad can you elborate on "Your code would only work if the SourceTableName column in the SourceTables table is of an integer type. " My column name is presently an varchar type On Jul 15, 11:49 am, Rahul wrote: > Hi, > Than

Re: Copying from Result Set to Array List

2009-07-15 Thread Rahul
Hi, Thanks for replying I am getting the following error [ERROR] Uncaught exception escaped java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String at com.example.test7.client.Test7$1MyHandler$1.onSuccess(Test7.java: 1) at com.google.gwt.user.client.rp

Re: Copying from Result Set to Array List

2009-07-15 Thread Sean
while(rs.next()) is fine and pretty standard way to go through. I'm confused by how you are adding the data to the ArrayList though. You get your resultSet which judging by your query should be TableNames, which I assume are Strings?. But you're getting it out as an INT then converting to a Strin

Re: Copying from Result Set to Array List

2009-07-15 Thread Chad
Rahul, Based on your query (select SourceTableName from SourceTables), I would guess that your result set would contain a single column with string data (char or varchar in SQL). If that's correct, then your loop should look more like this: while (rs.next()) { rowArray.add(rs.getString(1)); }

Copying from Result Set to Array List

2009-07-15 Thread Rahul
Hi, I apologize because this topic is again n again asked on the forum, but after reading the topics I was not able to get an answer to my problem. I am connecting to a server and trying to display an sql query on the browser. Here is my server side code: public class GreetingServiceImpl extends