You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joe Williams <jo...@mindspring.com> on 2003/10/06 20:28:08 UTC

NEWBIE: Cannot connect to MySQL db

When using an XSP to connect to a MySQL database, I get an error, according
to my WEB-INF/log/error.log:

"Could not get the datasource
org.apache.avalon.excalibur.datasource.NoValidConnectionException No valid
JdbcConnection class available at
org.apache.avalon.excalibur.datasource.JdbcConnectionFactory.newInstance
(JdbcConnectionFactory.java:185)"

I am running Cocoon 2.0.4, Tomcat 4.1.18, and Apache 2 on Red Hat 8.0, with MySQL 4.0

I followed the directions at http://wiki.cocoondev.org/Wiki.jsp?page=MySQL,
installing mysql-connector-java-3.0.8-stable-bin.jar in
$COCOON_HOME/WEB-INF/lib and $TOMCAT_HOME/common/lib/ ... got the same error
with the file in either place.

In $COCOON_HOME/WEB-INF/web.xml I added the line:

<!-- For MySQL Driver: -->
        com.mysql.jdbc.Driver
and also tried "org.gjt.mm.mysql.Driver" with the same effect.

In cocoon.xconf, I added:

  <jdbc name="DatabasePool">
    <pool-controller min="5" max="10"/>
    <dburl>jdbc:mysql://localhost:3306/DatabaseName</dburl>
    <user>MyUsername</user>
    <password>MyPassword</password>
  </jdbc>

where "MyUsername" and "MyPassword" belong to a valid MySQL user with
privileges for the database (and all databases, in fact).

Suggestions?


Re: NEWBIE: Cannot connect to MySQL db

Posted by Geoff Howard <co...@leverageweb.com>.
Joe Williams wrote:

> When using an XSP to connect to a MySQL database, I get an error, according
> to my WEB-INF/log/error.log:
> 
> "Could not get the datasource
> org.apache.avalon.excalibur.datasource.NoValidConnectionException No valid
> JdbcConnection class available at
> org.apache.avalon.excalibur.datasource.JdbcConnectionFactory.newInstance
> (JdbcConnectionFactory.java:185)"
> 
> I am running Cocoon 2.0.4, Tomcat 4.1.18, and Apache 2 on Red Hat 8.0, 
> with MySQL 4.0

This can be caused by database permissions improperly set up (among 
other things).  Does the user have permission to connect from localhost? 
Can you connect from a straight jdbc test class?  I seem to remember 
having to specify 127.0.0.1 instead of localhost (or vice versa) in the 
past with MySQL.

Geoff

> I followed the directions at http://wiki.cocoondev.org/Wiki.jsp?page=MySQL,
> installing mysql-connector-java-3.0.8-stable-bin.jar in
> $COCOON_HOME/WEB-INF/lib and $TOMCAT_HOME/common/lib/ ... got the same error
> with the file in either place.
> 
> In $COCOON_HOME/WEB-INF/web.xml I added the line:
> 
> <!-- For MySQL Driver: -->
>         com.mysql.jdbc.Driver
> and also tried "org.gjt.mm.mysql.Driver" with the same effect.
> 
> In cocoon.xconf, I added:
> 
>   <jdbc name="DatabasePool">
>     <pool-controller min="5" max="10"/>
>     <dburl>jdbc:mysql://localhost:3306/DatabaseName</dburl>
>     <user>MyUsername</user>
>     <password>MyPassword</password>
>   </jdbc>
> 
> where "MyUsername" and "MyPassword" belong to a valid MySQL user with
> privileges for the database (and all databases, in fact).
> 
> Suggestions?
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: NEWBIE: Cannot connect to MySQL db

Posted by Werner Guttmann <we...@gmx.net>.
Joe,

I can only offer you related advice on your problem, as I was
fiddling around with Cocoon, mySQL 4.0 on SuSe 8.2 the other day. I
had similar problems as you, though in the end I found the culprit
in the 3.1 alpha JDBC driver for mySQL that still has some heavy
bugs.

Why don't you configure your JDBC DataSource with Catalina (and use
it from within Cocoon) ? Have a look 


http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-exam
ples-howto.html

and you'll find a fully-fledged sample of how to setup a JDBC
DataSource for mySQL using Jakarta's DBCP package. Once you've done
that, all you need is the following entry in cocoon.xconf to get
things going:

<j2ee name="someName">
  <dbname>someDataSource</dbname>
</j2ee>

>From then on, please use the name "someName" in your XSPs, etc., to
specify the connection to use.

Werner

--Original Message Text---
From: Joe Williams
Date: Mon, 6 Oct 2003 13:28:08 -0500

When using an XSP to connect to a MySQL database, I get an error,
according
to my WEB-INF/log/error.log:

"Could not get the datasource
org.apache.avalon.excalibur.datasource.NoValidConnectionException
No valid
JdbcConnection class availabl
at
org.apache.avalon.excalibur.datasource.JdbcConnectionFactory.newInst
ance
(JdbcConnectionFactory.java:185)"

I am running Cocoon 2.0.4, Tomcat 4.1.18, and Apache 2 on Red Hat
8.0, with MySQL 4.0

I followed the directions at
http://wiki.cocoondev.org/Wiki.jsp?page=MySQL,
installing mysql-connector-java-3.0.8-stable-bin.jar in
$COCOON_HOME/WEB-INF/lib and $TOMCAT_HOME/common/lib/ ... got the
same error
with the file in either place.

In $COCOON_HOME/WEB-INF/web.xml I added the line:

<!-- For MySQL Driver: -->
        com.mysql.jdbc.Driver
and also tried "org.gjt.mm.mysql.Driver" with the same effect.

In cocoon.xconf, I added:

  <jdbc name="DatabasePool">
    <pool-controller min="5" max="10"/>
    <dburl>jdbc:mysql://localhost:3306/DatabaseName</dburl>
    <user>MyUsername</user>
    <password>MyPassword</password>
  </jdbc>

where "MyUsername" and "MyPassword" belong to a valid MySQL user
with
privileges for the database (and all databases, in fact).

Suggestions? 

 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org