aspose file tools
The moose likes Beginning Java and the fly likes Facing problem with startWith() in  for loop Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Facing problem with startWith() in  for loop" Watch "Facing problem with startWith() in  for loop" New topic
Author

Facing problem with startWith() in for loop

Happy S Singh
Ranch Hand

Joined: Nov 14, 2011
Posts: 47
Below is my snippet where I want to check in loop for all the queries passed that whether it starts with "SELECT" But I get the first query as true despite other queries are select



I get true in if(results[i].startsWith("SELECT")) only for the first select and after that for all other select's I get false
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
I tried it and it works...


Bye,
Nicola
Happy S Singh
Ranch Hand

Joined: Nov 14, 2011
Posts: 47
yeah its working.but now I am stuck with other exception "java.sql.SQLException: error occurred during batching: batch must be either executed or cleared"

I am getting "java.sql.SQLException: error occurred during batching: batch must be either executed or cleared" in the below code.I want to execute two queries.

Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 4756
    
    7

Happy S Singh wrote:in the below code....

Happy,

I split the very long line in your code. Please re-read the UseCodeTags page.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
Probably you can't, within the same Statement, execute select queries and batch updates.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Facing problem with startWith() in for loop
 
Similar Threads
how to execute multiple different queries in one execute?
database query
while loop in a while loop
database query
How to append data in CSV file using CSVWriter?