This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've encountered error connecting to db while inserting records into postgresql using java.
i have 4k records to be inserted to db from a text file, first i read the text file and put into List<String> and from List, i do a for loop for each string in the list to insert to db. the program run without any problem until around 1960+ records, it throws :- org.postgresql.util.PSQLException: The connection attempt failed.
i did close rs,ps,con for each newly created connection.
Do some changes to paste Line 1 and 2 after the for Loop bracket "}". Actually in your For Loop connection and prepared statement object were created and close on every record insertion. like what you said its insert 1960+ record in the database hope you will understand. please do separate this code to reduce the time of extra process and increase the performance.
hope it helps.. [ December 19, 2006: Message edited by: Saif uddin ]