• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling a create statement method but unable to figure out how in my scenario  RSS feed

 
Jack Tauson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now, I have something like the following in my try block:







So, for each of the IPAddresses that I got above in the `maindbsql`, that is `aa.aa.a.aaa` and `bb.bb.b.bbb` I want to call the `createStatement()` method in the following line mentioned in the above code:



Since, while establishing connection to these two IPAddresses, I am using `connections.put()` method as follows in the above code:


I don't have anything like Connection object `connRemote` that I have used for `xx.xx.x.xxx`, for my IP addresses aa.aa.a.aaa and bb.bb.b.bbb .

Could anyone please let me know if there is any way to overcome this problem?

Please let me know if I can answer any questions from my end.






P.S: The IP addresses I have used in my real code are IPV4 addresses and not alphabets.
 
Paul Clapham
Sheriff
Posts: 22711
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your code is too complicated. What's the purpose of putting the connections into a collection, then iterating through the collection (that's the part you didn't write yet), and then discarding the collection? Why not just something like


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!