I am creating a java application that connects to multiple databases. A user will be able to select the database they want to connect to from a drop down box.
The p
You're catching JNDI exception upon lookup of the nonexistent datasource but your singleton still keeps the reference to previously looked up datasource. As A.B. Cade says, null reference to ds upon exception, or even before that.
On a more general note, perhaps using Singleton is not the best idea.