Hello all:
I am trying to implement connection pooling in my applications and need some
help.
I started off by studying the small piece of code......
.............
Connection con = null;
Statement stmt = null;
try {
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/prash1");
con = ds.getConnection("login", "pwd");
} catch(java.lang.Exception e) {
System.err.print(e.getClass().getName());
System.err.println(e.getMessage());
}
.............
The basic question I had is what "jdbc/prash1" means? I used to use the
normal DriverManager class to get connected to a database. In that case, we
create a new System DSN mapping to the database. But now I am confused if it
the same in case of datasource too. If it is then what does "jdbc/" mean? Do
I have to map it someplace in web.xml/server.xml of tomcat? Can someone
please take some time to explain how I should be using datasource (if it has
anything to with tomcat)
Thanks
Prashanth
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|