Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database coding best practices

 
Duleep Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would be the best practices while you code for databases?
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Duleep Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out template for transactions.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here adeel beats me in posting link

Duleep :

hope it is clear now

Shailesh
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.javapractices.com is the

place otherwise google is best friend.

shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic