> Jeff Ramsdale wrote:
> > On the off chance someone has tried to connect the InterSystems Cache
> > database to Cocoon, I thought I'd ask for some assistance here...

<snip topic="Info on switching SQL Transformator sample to use a real
database" />

> > I can use Cache's SQL Manager tool and it doesn't look like the table is
> > ever created or populated (makes sense, given the error
> message). I imagined
> > table creation would occur upon the occasion of one of my page
> requests but
> > I haven't quite figured out at what point this would be. Would
> appreciate a
> > pointer...
>
> Nope - it's not created automatically.  It's already defined and
> prepopulated in hsql in the distribution just for ease of the
> demonstration, but if you want to use a different database you need to
> create and do any necessary pre-populating yourself.  There is a .sql
> file somewhere in the source (either hsql block or database block) that
> could get you well on you way to doing that but you may need to modify
> it to work on your specific DB which I've no experience with.

Thanks for that info. I haven't yet figured out how to load data into Cache
so that it's available to SQL, so I switched to MySQL. I loaded the sample's
dump file and can see that the data is available.

However, I ran into something I couldn't explain. I was under the impression
that it didn't hurt to list multiple drivers as the appropriate one would be
selected according to the datasource setting in cocoon.xconf. Here's a
snippet from my web.xml:

    <init-param>
      <param-name>load-class</param-name>
      <param-value>
        <!-- For parent ComponentManager sample:
        org.apache.cocoon.samples.parentcm.Configurator -->
        <!-- For IBM WebSphere:
        com.ibm.servlet.classloader.Handler -->

        <!-- For Database Driver: -->
        org.hsqldb.jdbcDriver

        <!-- Cache Driver: -->
        com.intersys.jdbc.CacheDriver

        <!-- MySQL Driver: -->
        com.mysql.jdbc.Driver

      </param-value>
    </init-param>

I received the following error (Why the heck doesn't LogFactor5 let you copy
to the clipboard?!):

  java.sql.SQLException: Unable to connect. Invalid URL:
jdbc:mysql://127.0.0.1:3306/test?autoReconnect=true
     at com.intersys.jdbc.CacheDriver.connect(CacheDriver.java:104)
     at java.sql.DriverManager.getConnection(DriverManager.java:512)

Question #1: Why did it use the InterSystems Cache driver when the MySQL
driver was available?

Question #2: My presumption on driver availability is predicated on my
understanding that Cocoon can figure out from my cocoon.xconf that
"jdbc:mysql://..." is somehow mapped to the MySQL driver in web.xml. How is
this really done in Cocoon? If I'm wrong and I should only have one driver
in there, how come it grabs the InterSystems driver and not the hsqldb
driver? But that doesn't make sense to me, because I imagine it's possible
to connect to multiple databases in one Cocoon app. Here's my cocoon.xconf
snippet:

       <jdbc logger="core.datasources.personnel" name="personnel">
          <pool-controller min="5" max="10"/>
          <dburl>jdbc:mysql://127.0.0.1:3306/test?autoReconnect=true</dburl>
           <user>TestUser</user>
           <password>test</password>
       </jdbc>

[ Gripe: It's causing me real grief that Cocoon won't shut down cleanly
under Tomcat. Tragic that this wasn't fixed before 2.1 ->
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18131 ]

Ok, so if I comment out the other two drivers in web.xml I can coerce Cocoon
into using the proper MySQL driver. Reloading Cocoon and requesting the page
again I get the "Failed to obtain connection. Made 5 attempts with 5000ms
interval" error. The log shows:

  java.sql.SQLException: Server connection failure during transaction.
  Attempted reconnect 3 times. Giving up.
     at com.mysql.jdbc.Connection.createNewIO(Connection.java:1704)
     at com.mysql.jdbc.Connection.<init>(Connection.java:491)
     at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
     at java.sql.DriverManager.getConnection(DriverManager.java:512)
etc.

Question #3: Do you have any suggestions on debugging this? I've checked the
table using MySQL's Control Center and verified that the user exists and the
password is right and has permissions, etc. I'm running Cocoon and MySQL on
the same system; if Control Center can connect I would expect Cocoon to be
able to as well, no?

Incidentally I'm running Tomcat 4.1.18, Cocoon 2.1rc2-dev, and Java 1.4.1_02
on Windows ME (the latter is _A_ problem, but probably not _THE_ problem!).

Thoughts?

> Geoff

Jeff



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to