The moose likes JDBC and the fly likes Database coding best practices 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 » Databases » JDBC
Reply Bookmark "Database coding best practices" Watch "Database coding best practices" New topic
Author

Database coding best practices

Duleep Singh
Greenhorn

Joined: Mar 21, 2005
Posts: 5
What would be the best practices while you code for databases?
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

Originally posted by Duleep Singh:

What would be the best practices while you code for databases?


Duleep,

There are endless best practice for database coding, and always there is scope of making it better.but few basic tips are here.

1.Use Connection pools
2.Encapsulate connections
3.Always close connection
4.Use prepared statement
5.Use Data access objecs
6.Keep SQL out of code
7.Remember the basics of database design
8.Use template for transactions
9.Do not perform database tasks in code
10.Reduce database code duplication
11.Consider using standard SQL for better portability


Shailesh
[ March 22, 2005: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Duleep Singh
Greenhorn

Joined: Mar 21, 2005
Posts: 5
Hi Shailesh,
Thanks for the reply.
But can you explain me point 8.
I didnt quiet understand it.

"8.Use template for transactions"

Thanks,
Chinmay
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Check out template for transactions.
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

here adeel beats me in posting link

Duleep :

hope it is clear now

Shailesh
Sripathi Krishnamurthy
Ranch Hand

Joined: Mar 07, 2005
Posts: 232
where would I get detailed explaination on the tips mentioned here?
It would be great to see examples whereever applicable.

Thanks
Sripathi
[ March 24, 2005: Message edited by: Sripathi K S ]
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

http://www.javapractices.com is the

place otherwise google is best friend.

shailesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Database coding best practices
 
Similar Threads
Ant best practices
Srikanth Shenoy: Why not only "Best Practices"?
to Ray Lai: Best Practices/Patterns for web services
Best Practices
Ajax- design patterns?