Gagan Gulati

+ Follow
since Jul 27, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gagan Gulati

As you are using callable statements over a Stored proc. That stored proc might return some parameters.
To get these parameters in your Java variables, you have to first register these parameters.

I feel this is a simple logical issue.

You can always subtract the concurrency count from 10 , get the remaining ( say 'n') and then do a
rs.absolute(n) and start moving ahead !

Are you picking up these values from the database and then trying to show them ?
Or are you hard coding the values in the pages ?
Using DB, one easy way of doing it wud be to to show the 10/20/50 values on each page and do a next which grabs the next 50 values. You can write a simple Javabean method which does so or in the same JSP, you can submit the request with these paramters, and do getParameter() in the beginning of the page and retrieve values.

Let me know if u want to do it with Db...
I have worked quite a lot on it

19 years ago
In your code, you are trying to distinguish between Odd and Even numbers which is increasing the complexity.

Better way could have been to use an integer and increase it by one always. This increase of number and writing to a file can be pushed to a synchronized block/method.

It would make sure that you are writing them one by one.
make the threads sleep for a while.

Basically, create a single class and invoke 2 instances of that class thread and then make them write.
Makes sense ?

Just do a list.add(new Integer(result.getInt("someint")))
This shud work ..

Lists take only composite types

Are you getting all the 20 questions in one go ?
I mean, are you using the resultset to return you all 20 questions. You display them on the JSP and then the user picks up one of them ?
If that is the case, when the user picks up some other state, you can just fire another query using a Statement object.

Not really.
Because if you do that, 3 nextvals would come from the sequence.

Instead you could get the result of the select query first and then add the three Inserts in the batch