• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple preparedStatements 1 Connection

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not to sure if I'm doing this correctly, well as a matter of fact I'd say I'm not as the Update although not returning an error is not updating the second statement ps2.

The ps statement executes OK its the second one that won't execute.

What I'm doing is pulling data writing to a file to ftp across the ether, then I'm storing the PK in a vector in the query loop.

Then I get the values from the vector to use as the argument in this case mobile_phone_number in ststement 2 ps2.

I don't think the batch is executing can some one give me a hand with this.


 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rastas,
Where are you closing the resultsets? It is good practice to do this near where you close the prepared statement.

Also, not that the executeBatch returns an array of integers. So on failure, these integers can be zero rather than throw an exception.
 
rastas biggs
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne,

the integers in the arry are not zero, I think that I'm stuck in the loop and the executeBatch is not even reached.

How do i exit Enumeration after the last record? other wise I'll have to write the file string token into ArrayList and use a for/loop based on the ArrayList size.

I know this works but I rather use the Enumeration

RB
[ November 04, 2004: Message edited by: rastas biggs ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rastas,
The loop looks ok to me. What does the console show for the printlns in the loop? Does it execute a certain number of times or infinitely?

Just a note: Iterators are prefered over Enumerations. But that doesn't make a difference for the purposes of this discussion.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just the MSN value, i did have another println under the executeBatch and in never hits, mind you I am writing the values to a textfile adding them to the ArrayList, closing the Printer and then processsing the array to use the same connection, if that has any impact at all.

I use a for loop and did a allMSN.size() to limit the loop and it worked fine.

Bill c/o Rastas
[ November 05, 2004: Message edited by: Bill Fences ]
reply
    Bookmark Topic Watch Topic
  • New Topic