You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vara Prashanth <pr...@yahoo.com> on 2001/10/15 17:38:39 UTC
JDBC Problems....
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
Re: JDBC Problems....(third posting)
Posted by Dmitri Colebatch <di...@bigpond.net.au>.
"jdbc/prash1" is the JNDI name of the datasource. It is not directly
related to ODBC or system dsn (if I understand the system dsn properly its
tied to ODBC right?). If you have an ODBC database you will need to
create a datasource instance to access that, and have that placed in
JNDI.
Not sure where the exact doco on that is, but
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html
should give you a start. btw - the "jdbc/" is convention for logically
grouping resources.
hth
dim
On Mon, 15 Oct 2001, Vara Prashanth wrote:
> My third posting of the same message...can someone please answer it? I will
> be happy if someone can point me to some website atlease.....
> Thanks
>
> 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
>
>
RE: JDBC Problems....(third posting)
Posted by Ylan Segal <yl...@digiworks.tv>.
JDBC problems don't have much to do with tomcat. Maybee you should look at
the documentation of the connection pooling package that you are using.
Good luck.
Ylan
> -----Original Message-----
> From: Vara Prashanth [mailto:prash_mail_lists@yahoo.com]
> Sent: Monday, October 15, 2001 2:28 PM
> To: tomcat-user@jakarta.apache.org
> Subject: JDBC Problems....(third posting)
>
>
> My third posting of the same message...can someone please answer
> it? I will
> be happy if someone can point me to some website atlease.....
> Thanks
>
> 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
>
>
JDBC Problems....(third posting)
Posted by Vara Prashanth <pr...@yahoo.com>.
My third posting of the same message...can someone please answer it? I will
be happy if someone can point me to some website atlease.....
Thanks
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