In cotrast, i have installed Oracle and worked very well, but MySql didn't
work with me. I am using Connecter/J from MySql website, the beta version, I
put the jar file in the CATALINA_HOME/lib, and i add it to the CLASSPATH.
and I followed the instructions provided in Tomcat documentation, exactly,
Didn't work :(
On 7/24/07, David Smith <dns4@(protected):
>
> I've never dealt with Oracle but have done a lot of MySQL installs
> without a single failure. Your config outside of the web.xml doesn't
> look wrong in any way.
>
> You might want to put the <resource-ref> block in your web.xml as
> described in the how-to's. It doesn't hurt and is part of the servlet
> spec.
>
> --David
>
>
> Mohammed Zabin wrote:
>
> > No, the same error, You know what David?? I put nothing in web.xml, I am
> > confused about this issue, when to use web.xml, and it might be the
> > reason
> > behind the unsuccessfull MySql Connection, I follow the same procedure I
> > followed to configure Oracle DBCP, I think it must work for MySql,
> right?
> >
> > On 7/24/07, David Smith <dns4@(protected):
> >
> >>
> >> Try this variant of your code:
> >>
> >> Context initContext = new InitialContext();
> >> DataSource ds =
> >> (DataSource)initContext.lookup("java:comp/env/jdbc/TestMySql");
> >> Connection conn = ds.getConnection();
> >>
> >> out.println("Connection Established");
> >>
> >> Essentially when you lookup java:comp/env/jdbc/TestMySql, that's the
> >> full JNDI path to the DataSource and returns a DataSource type object,
> >> not a Context type object.
> >>
> >> --David
> >>
> >> Mohammed Zabin wrote:
> >>
> >> > Ok thank you, I did the following as you have stated:
> >> >
> >> > 1. in server.xml:
> >> > <Resource name="jdbc/TestMySql" auth="Container"
> >> > type="
javax.sql.DataSource"
> >> > maxActive="100" maxIdle="30" maxWait="10000"
> >> > username="root" password="exam" driverClassName="
> >> >
com.mysql.jdbc.Driver"
> >> > url="jdbc:mysql://localhost:3306/exam"/>
> >> > 2. in context.xml
> >> > <ResourceLink global="jdbc/TestMySql" name="jdbc/TestMySql" type="
> >> >
javax.sql.DataSource"/>
> >> >
> >> > 3. in my test page:
> >> > Context initContext = new InitialContext();
> >> > Context envContext =
> >> > (Context)initContext.lookup("java:comp/env/jdbc/TestMySql");
> >> > DataSource ds = (DataSource)envContext.lookup("jdbc/TestMySql");
> >> > Connection conn = ds.getConnection();
> >> >
> >> > out.println("Connection Established");
> >> > And i put nothing in web.xml, I have the following error:
> >> >
> >> >
org.apache.jasper.JasperException: Unable to compile class for JSP:
> >> >
> >> >
> >> >
> >> > Stacktrace:
> >> >
org.apache.jasper.compiler.DefaultErrorHandler.javacError(
> >> DefaultErrorHandler.java:85)
> >> >
> >> >
org.apache.jasper.compiler.ErrorDispatcher.javacError(
> >> ErrorDispatcher.java:330)
> >> >
> >> >
org.apache.jasper.compiler.JDTCompiler.generateClass(
> >> JDTCompiler.java:415)
> >> >
> >> >
org.apache.jasper.compiler.Compiler.compile (
Compiler.java:308)
> >> >
org.apache.jasper.compiler.Compiler.compile (
Compiler.java:286)
> >> >
org.apache.jasper.compiler.Compiler.compile (
Compiler.java:273)
> >> >
org.apache.jasper.JspCompilationContext.compile(
> >> JspCompilationContext.java:566)
> >> >
> >> >
org.apache.jasper.servlet.JspServletWrapper.service(
> >> JspServletWrapper.java:308)
> >> >
> >> >
> >>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java
> >> :320)
> >> >
> >> >
org.apache.jasper.servlet.JspServlet.service (
JspServlet.java:266)
> >> >
javax.servlet.http.HttpServlet.service (
HttpServlet.java:803)
> >> >
> >> >
> >> >
> >> > On 7/23/07, David Smith <dns4@(protected):
> >> >
> >> >>
> >> >> A few things to consider:
> >> >>
> >> >> 1. Either place your Resource definition in server.xml as a
> >> >> GlobalResource *OR* in your webapp's context.xml file.
> >> >>
> >> >> 2. If you have the Resource defined in the GlobalResources, that's
> >> the
> >> >> only time you need to use a ResourceLink element in context.xml.
> >> >>
> >> >> 3. Drop the autoReconnect parameter in your mysql URL. It has it's
> >> >> uses, but not in a pooled environment.
> >> >>
> >> >> 4. You should probably be attempting to use the path
> >> >> java:comp/env/jdbc/TestMySQL (note the lack of a '/' before comp) as
> >> >> described in the JNDI howto on tomcat's website. I think I saw you
> >> >> using java:/comp/env/jdbc/TestMySQL in one of your posts.
> >> >>
> >> >> 5. Please post relevant messages from your logs if this isn't
> >> working.
> >> >>
> >> >> --David
> >> >>
> >> >> Mohammed Zabin wrote:
> >> >>
> >> >> > Would you please be more specific? which file you mean? I have
> >> created
> >> >> > Oracel connection Pool as the stated way above, and it's worked
> >> fine,
> >> >> > shall
> >> >> > i put resource defeninitoin in context.xml only?
> >> >> >
> >> >> > On 7/22/07, Pid <p@(protected):
> >> >> >
> >> >> >>
> >> >> >> You only need one resource definition.
> >> >> >> You only need a resource link definition if your resource is a
> >> global
> >> >> >> one.
> >> >> >>
> >> >> >> Simplify your configuration and then post the error message
> >> from the
> >> >> >> logs so we can see Tomcat says is wrong.
> >> >> >>
> >> >> >> p
> >> >> >>
> >> >> >>
> >> >> >> Mohammed Zabin wrote:
> >> >> >> > Hi All
> >> >> >> >
> >> >> >> > I have confiured oracle connection pool on my tomacat 6, and it
> >> >> worked
> >> >> >> > fine.
> >> >> >> > When i came to configure MySql, I repeated the same steps for
> >> >> Oracle
> >> >> >> > databse, with considering the specfication of MySql database.
> >> But
> >> >> it's
> >> >> >> > didn't work. Any Help please about configuring MySql,
> >> >> >> > I downloaded MySql connector from mysql website and place it in
> >> >> >> > CATALINA_HOME/lib directory, and i put the following:
> >> >> >> >
> >> >> >> > 1. in server.xml file:
> >> >> >> > <Resource name="jdbc/TestMySql" auth="Container"
> >> >> >> > type="
javax.sql.DataSource"
> >> >> >> > maxActive="100" maxIdle="30" maxWait="10000"
> >> >> >> > username="*" password="*" driverClassName="
> >> >> >> >
com.mysql.jdbc.Driver"
> >> >> >> >
> >> >> >> > url="jdbc:mysql://localhost:3306/exam?autoReconnect=true"/>
> >> >> >> >
> >> >> >> > 2. in web.xml file
> >> >> >> > <resource-ref>
> >> >> >> > <description>Oracle Datasource example</description>
> >> >> >> > <res-ref-name>jdbc/TestMySql</res-ref-name>
> >> >> >> > <res-type>
javax.sql.DataSource</res-type>
> >> >> >> > <res-auth>Container</res-auth>
> >> >> >> > </resource-ref>
> >> >> >> >
> >> >> >> > 3. in context.xml file (on server's context.xml file):
> >> >> >> > <Resource name="jdbc/TestMySql" auth="Container"
> >> >> >> > type="
javax.sql.DataSource"
> >> >> >> > maxActive="100" maxIdle="30" maxWait="10000"
> >> >> >> > username="*" password="*" driverClassName="
> >> >> >> >
com.mysql.jdbc.Driver"
> >> >> >> > url="jdbc:mysql://localhost:3306/exam"/>
> >> >> >> >
> >> >> >> > 4. in cotext.xml file ( In my web application's context.xml
> >> file):
> >> >> >> > <ResourceLink global="jdbc/TestMySql" name="jdbc/TestMySql"
> >> type="
> >> >> >> >
javax.sql.DataSource"/>
> >> >> >> >
> >> >> >> > Any Help please?
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >
> >> >>
> >> >>
> >> >>
> ---------------------------------------------------------------------
> >> >> To start a new topic, e-mail: users@(protected)
> >> >> To unsubscribe, e-mail: users-unsubscribe@(protected)
> >> >> For additional commands, e-mail: users-help@(protected)
> >> >>
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@(protected)
> >> To unsubscribe, e-mail: users-unsubscribe@(protected)
> >> For additional commands, e-mail: users-help@(protected)
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@(protected)
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>