Re: Setting up jdbc connections

2002-03-05 Thread Lev Assinovsky

Here is how I install mysql JDBC.
1. In server.xml (no need realm):
  Resource name=lev/DataSource auth=Container
type=javax.sql.DataSource/
  ResourceParams name=lev/DataSource
parameternameuser/namevalue.../value/parameter !--
your login --

parameternamepassword/namevalue.../value/parameter!-- your
passwd --
parameternamedriverClassName/name
  valueorg.gjt.mm.mysql.Driver/value/parameter
parameternamedriverName/name
  valuejdbc:mysql://localhost:3306/WV/value/parameter
  /ResourceParams

2. In $CATALINA_HOME/webapps/examples/WEB-INF/web.xml:

resource-ref
  res-ref-namelev/DataSource/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  res-sharing-scopeShareable/res-sharing-scope
/resource-ref

3. In yout JSP or Bean:
 Context ctx  = new InitialContext();
 Context envCtx = (Context)ctx.lookup(java:comp/env);
 DataSource _ds = (DataSource)envCtx.lookup(lev/DataSource);
 
 Connection con _ds.getConnection();
 ...
 Statement st = con.createStatement(...);
 ResultSet rs = st.executeQuery(select * from bla_bla);

JNDI will create instance of your DataSource (with automatic connection).
But you have to have tyrex*.jar in one of common dirs.
If not I advise you to switch to Tomcat 4.0.x.
Also you must put your (Postgres) JDBC jar into $CATALINA_HOME/lib
Good luck.

Andrew Falanga wrote:

 Hello everyone,

 Setting up Tomcat is NO easy project.  I've been struggling for
 about a week and a half to get tomcat to read a special
 servlet/application/I really don't know what to call it.
  (Unfortunately, that's my biggest problem, I'm very unfamiliar with
 things I'm playing around with right now.)

 Ok, in simplest terms possible here's the deal.  I'm trying to get a
 working model of something my company calls a portal.  Basically, it's
 nothing more than a product that will allow a person to use *.jsp
 rendered web pages to access/control/manipulate data contained withing
 Oracle databases.  This is the long term.  Right now, I need to get the
 application working to allow someone to log in.  The database which
 controls user access is NOT part of Oracle.  It is a PostgreSQL database.

 How, exactly, do I setup the JDBC stuff to interact with PostgreSQL?
  I've been reading through the users guide, the paper on server.xml and
 the FAQ.  The information is comprehensive, I do think lacking in some
 parts, but none-the-less comprehensive.  (I do not mean to start flame
 wars or anything else.  However, for example, I downloaded and installed
 tomcat 3.3a via rpm for Red Hat Linux, the rpm was made by tomcat
 developers not red hat.  After installing, I'm reading through the users
 guide and there are several directories meantioned that DO NOT exist.
  Such as, %TOMCAT_HOME/bin and many others.  This is what I mean by
 lacking.)

 How exactly am I going to go about setting up the database
 connectivity?  From what I've read, I've got to configure some kind of a
 JDBC Realm in the server.xml, but how exactly.  I did try, following the
 syntax example given in one of the user guide documents, but after
 restarting tomcat, tomcat was broken.  Absolutely, nothing was being
 served up.  I did make syntax substitutions to allow for my database vs.
 the database given in the example, and yes I'm absolutely open to the
 fact that my syntax was wrong.  Basically, what needs to be done?  I'm
 really nearing the end of my rope on this one.

 Andy

 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]

--
Lev AssinovskyPeterlink Web
ProgrammerSt. Petersburg, Russia
Tel/Fax: +7 812 3275343   197022 ul.Chapigina 7Á
E-mail: [EMAIL PROTECTED]




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Setting up jdbc connections

2002-03-04 Thread Andrew Falanga

Hello everyone,

Setting up Tomcat is NO easy project.  I've been struggling for 
about a week and a half to get tomcat to read a special 
servlet/application/I really don't know what to call it. 
 (Unfortunately, that's my biggest problem, I'm very unfamiliar with 
things I'm playing around with right now.)

Ok, in simplest terms possible here's the deal.  I'm trying to get a 
working model of something my company calls a portal.  Basically, it's 
nothing more than a product that will allow a person to use *.jsp 
rendered web pages to access/control/manipulate data contained withing 
Oracle databases.  This is the long term.  Right now, I need to get the 
application working to allow someone to log in.  The database which 
controls user access is NOT part of Oracle.  It is a PostgreSQL database.

How, exactly, do I setup the JDBC stuff to interact with PostgreSQL? 
 I've been reading through the users guide, the paper on server.xml and 
the FAQ.  The information is comprehensive, I do think lacking in some 
parts, but none-the-less comprehensive.  (I do not mean to start flame 
wars or anything else.  However, for example, I downloaded and installed 
tomcat 3.3a via rpm for Red Hat Linux, the rpm was made by tomcat 
developers not red hat.  After installing, I'm reading through the users 
guide and there are several directories meantioned that DO NOT exist. 
 Such as, %TOMCAT_HOME/bin and many others.  This is what I mean by 
lacking.)


How exactly am I going to go about setting up the database 
connectivity?  From what I've read, I've got to configure some kind of a 
JDBC Realm in the server.xml, but how exactly.  I did try, following the 
syntax example given in one of the user guide documents, but after 
restarting tomcat, tomcat was broken.  Absolutely, nothing was being 
served up.  I did make syntax substitutions to allow for my database vs. 
the database given in the example, and yes I'm absolutely open to the 
fact that my syntax was wrong.  Basically, what needs to be done?  I'm 
really nearing the end of my rope on this one.

Andy


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Setting up jdbc connections

2002-03-04 Thread Emir Alikadic

On 03/04/2002 04:18 PM, Andrew Falanga wrote:

Hello everyone,


Hi,


Setting up Tomcat is NO easy project.  I've been struggling for 
about a week and a half to get tomcat to read a special 
servlet/application/I really don't know what to call it. 
 (Unfortunately, that's my biggest problem, I'm very unfamiliar with 
things I'm playing around with right now.)


Setting up Tomcat is a breeze, but not for somebody who doesn't know the 
difference between a servlet and an application.


Ok, in simplest terms possible here's the deal.  I'm trying to get a 
working model of something my company calls a portal.  Basically, it's 
nothing more than a product that will allow a person to use *.jsp 
rendered web pages to access/control/manipulate data contained withing 
Oracle databases.  This is the long term.  Right now, I need to get the 
application working to allow someone to log in.  The database which 
controls user access is NOT part of Oracle.  It is a PostgreSQL database.


Designing and implementing that nothing more than a product is what 
many of us have gone through 4 years of university and hundreds of books 
and white papers to learn to do.


How, exactly, do I setup the JDBC stuff to interact with PostgreSQL? 
 I've been reading through the users guide, the paper on server.xml and 
the FAQ.  The information is comprehensive, I do think lacking in some 
parts, but none-the-less comprehensive.  (I do not mean to start flame 
wars or anything else.  However, for example, I downloaded and installed 
tomcat 3.3a via rpm for Red Hat Linux, the rpm was made by tomcat 
developers not red hat.  After installing, I'm reading through the users 
guide and there are several directories meantioned that DO NOT exist. 
 Such as, %TOMCAT_HOME/bin and many others.  This is what I mean by 
lacking.)


If you don't understand that $TOMCAT_HOME (or %TOMCAT_HOME%, if you're 
on WIndows) refers to the environment variable TOMCAT_HOME you were 
supposed to create as part of installation, I suggest you go back and 
first learn a few basics of the operating system you're working on (mail 
headers indicate Linux).


How exactly am I going to go about setting up the database 
connectivity?  From what I've read, I've got to configure some kind of a 
JDBC Realm in the server.xml, but how exactly.  I did try, following the 
syntax example given in one of the user guide documents, but after 
restarting tomcat, tomcat was broken.  Absolutely, nothing was being 
served up.  I did make syntax substitutions to allow for my database vs. 
the database given in the example, and yes I'm absolutely open to the 
fact that my syntax was wrong.  Basically, what needs to be done?  I'm 
really nearing the end of my rope on this one.


For basic database connectivity you don't need JDBC realm, all you need 
is a JDBC driver for the RDBMS you're working with (PostgreSQL or 
Oracle) and use the regular JDBC syntax in either JSPs or servlets. 
 You can also use JDBC taglib, but you still need the driver.  If this 
paragraph doesn't make sense, I suggest you stay away from Tomcat until 
you learn the basics of Java and J2EE programming.


Andy


Emir.


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Re: Setting up jdbc connections

2002-03-04 Thread Joel Rees

Andrew Falanga wrote:

 However, for example, I downloaded and installed
 tomcat 3.3a via rpm for Red Hat Linux,
 ...
  Such as, %TOMCAT_HOME/bin and many others.

This looks kinda weird to me.

Can you provide more specifics to our helpful friends on the list? OS?
Hardware? Did you ever get the examples to run? Where did you get the RPM?
(CD?Redhat?jakarta?) Did you let it unpack by the defaults? Etc.

Joel Rees




--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]