Thanks a lot for your answer Prabhakar ! I understand things a lot more now !
But here are a little more doubts:
Just to confirm, so JNDI actually allows you to make more portable code ? (Hardcoding the data source like I did doesnt
make portable code I guess ?) Its like different applications may be using different dbms's or different versions of
dbms's and thus may have different names for their respective classes implementing DataSource interface ? Isnt it?
JNDI can itself somehow map names to the correct DataSource name? I have understood it right, haven't I ?
Also, you said
MysqlConnectionPoolDataSource will create a PooledConnection when you call
PooledConnection pc = ds.getPooledConnection();
then what does con=pc.getConnection(); do ? I cant understand why we need two statements to get a connection to the pool instead of just one. (what is the difference between the two ?)
Thanks again !!
(and thanks Jan Cumps, feels good to be here)