java with jdbc

Hi, I need to check a field loginflag in the table queue.According to the loginflag, i have to check 3 things.The first thing is if loginflag for all the users is 0,i should print "All our agents are logged off.try later". second thing is if loginflag=1 for all the agents,message should be "All our agents are busy".The third thing is if the loginflag is 1 and the field callstatus is 0,the message should be "send the call to this logged user". How could i check this? please assist me.

. . . and please edit your original post to Use A Meaningful Subject Line. Your post doesn't seem to be about "Java" nor about "JDBC." It is probably about "with," [ ] but that doesn't help people scanning the menu to work out which posts to read and reply to.

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518

posted Jun 02, 2008 01:50:00

0

Thanks.I have checked like this.but is there any query to check directly all the agents are busy?

Hi, first thing first, code tags wont work if your code is not indented. and you can improve your code I think, but Campbell will not allow me to do that . but your current code seems to do the work isn't it.

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41599

31

posted Jun 03, 2008 04:17:00

0

Originally posted by Amit Ghorpade:

and you can improve your code I think, but Campbell will not allow me to do that

Cheeky so-and-so. You're nearly as bad as Rob Prime.

Agree with what you say; just having a quick look at the code, I think it will work. Please drop some hints about what would improve it, but I think the thread is now actually about JDBC, even though the subject is not at all informative.

So you will have to make further comments on the JDBC forum, where I shall move this thread!

And regarding the hint, I would like to suggest to improve the SQL query if she is good with database. I am not aware of the database design she's using but I think the query she mentioned isn't optimal.

Hope this helps

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41599

31

posted Jun 06, 2008 08:00:00

0

Originally posted by Amit Ghorpade:

Please don't take it personally.

Don't worry, I didn't. I presumed you were joking. ;)

I agree, now I have looked at it, that select * isn't optimal. Would you use a count()? Don't know; my SQL isn't that good.

Suggest the query is old enough that you can tell us the optimised version.