This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes can not insert to DB after a while! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "can not insert to DB after a while!" Watch "can not insert to DB after a while!" New topic
Author

can not insert to DB after a while!

sahar sa
Ranch Hand

Joined: Jul 06, 2009
Posts: 102
Dear,
I have a method which every time it runs, it will add 10 row to my DB but after 3 or 4 times running this file it doesn't add anything to my db. and even it does not throw me any thing like error or ... . I dont know why cuz it works very well for first 3 or 4 times but after ....!
do you have any idea?

and some thing else! after that I can not do any thing in MySQL Command Line Client. seems that it hangs!
I realy dont know what to do!
thank you.
Sahar.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41124
    
  45
There could be any number of reasons. Without seeing the code it's all uninformed speculation, though.


Ping & DNS - my free Android networking tools app
Ranveer K Kumar
Ranch Hand

Joined: Sep 13, 2009
Posts: 64


could you please post the code!
sahar sa
Ranch Hand

Joined: Jul 06, 2009
Posts: 102
Hi dear,
Of curse, here is the code for Insert and a piece of code which runs the insert class.

///////////insert////////////////////////////



/////////////insert call////////////



and I dont know why my MYSQL COMMAND does not work any more?!

thank you so much!
Sahar.
James Ward
Ranch Hand

Joined: Apr 27, 2003
Posts: 263
Ranveer K Kumar
Ranch Hand

Joined: Sep 13, 2009
Posts: 64

first check the loop; is it your real code ? then loop is here <5 increase it to <10 and please follow the James Ward update code of static connection method..


regards
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41124
    
  45
James Ward wrote:



if "conn" is declared at class level, then why is it declared again here? Furthermore, getConnection does not return a connection - it's declared void. Let's not confuse the issue by posting non-working code.
sahar sa
Ranch Hand

Joined: Jul 06, 2009
Posts: 102
OOh my god! Dear friends specialy James Ward and Ulf Dittmer Thank you sooooooooooooo much!. I just change a little things void--> Connection and now it works!!!

Thanks again!
Sahar
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can not insert to DB after a while!
 
Similar Threads
is exist any multi record catalogue? or better to use DB? or array?
Design Opinion
Database Locks
cleared scwcd today 94%, cleared scjp(84%) 1 year ago
Oh gosh, i think it's a BUG ?!