In the web-application I\'m developing I currently use a naive solution when connecting to the database:
Connection c = DriverManager.getConnection(\"url\",
I can recommend these techniques for .NET programmers:
Here is useful articles from CodeProject: