PDA

View Full Version : Mondrian 2.1 unable to connect with MySql



fobien
10-12-2006, 12:16 PM
We are having serious difficulties with Mondrian 2.1 running on Linux/Tomcat, with a non-embedded MySQL test database.

Here is the version info :
MySql 5.0.20
JDK 1.5, not 1.4 (could this be a problem?)
Tomcat 5.0
MySql Connector 3.1.13
Xalan 2.6

After having completed steps 2.2 and 3 of "How to Instal Mondrian" (also using advice from jerics99), we were able to display the Mondrian OLAP server page with "Mondrian examples" and "Other links".

All JPivot links produce this error message:
---------------------------------------------------------------------------------------------------
JPivot had an error ...

javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: null

javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.servlet.jsp.JspException: null
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:821)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
at org.apache.jsp.testpage_jsp._jspService(testpage_jsp.java:258)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
(etc.)
---------------------------------------------------------------------------------------------------

On the other hand, executing a random query using the "Basic Interface for ad-hoc queries" leads to the following:
---------------------------------------------------------------------------------------------------

java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at

org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.j

ava:51)
at

org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:771)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:95)
at mondrian.rolap.RolapSchema.getDialect(RolapSchema.java:263)
(etc.)
---------------------------------------------------------------------------------------------------

It seems this page takes its connection string from the MDXQueryServlet section of web.xml. I attempted all kinds of variants, but it all boils down to this: the NullPointerException appears whenever the Jdbc property starts with "jdbc:odbc:mysql", followed by any existant or non-existant database URL. It has nothing to do with the JdbcUSer/JdbcPassword or even JdbcDrivers properties.

Now if I replace jdbc:odbc:mysql with either jdbc:hsqldb or jdbc:postgresql, I get an "Error while creating SQL dialect/No suitable driver" message.

This leads me to think there must be a problem with the MySql driver, not the test DB.

We would very much like to use Mondrian in our final Masters year lab sessions. Can anyone help? I will gladly give feedback here.

fobien
10-12-2006, 11:15 PM
I've just replaced JDK 1.5 with JDK 1.4. After shutting down/restarting Tomcat, I still get the same error messages :-(

I'll see if I can connect to some other database, Oracle or PostgreSQL...

Your help is still very very welcome though !!

mdamour
10-14-2006, 09:41 PM
With mysql you do not need to use jdbc:odbc, infact, I'm not sure what the result of this would be.

What you need to do is get a true jdbc (type 4) set of database connection information for your mysql database.

This should be easy to find as it is quite standard.

The driver should be: com.mysql.jdbc.Driver
The connect string: jdbc:mysql://yoursever:3306/yourdb

Notice jdbc:mysql not jdbc:odbc, whenever you see no suitable driver, either your connect string or driver is wrong or the driver jar is not found.

Hope this helps out.
-Mike

fobien
10-17-2006, 04:21 AM
Thank you so much for your help! I followed your advice and everything is working fine now.

Just a few observations on how I made things work:

I used the native MySQL Connector/J from http://www.mysql.com/products/connector/j/ (version 5.0.3). After unzipping, I placed the mysql-connector-java-5.0.3-bin.jar file in common/endorsed.
The connect string is just jdbc:mysql://myserver/mydatabase , the port number is not required (3306 by default).
Regarding my previous post, SDK 1.5 is not a problem.

I haven't pushed the Oracle track further, all I can say is that this connect string: jdbc:oracle:thin@servername:1521:instancename doesn't seem to work with oracle.jdbc.OracleDriver.

But for now my main priority is to find a way to compile my own XML schema file, I might post a new thread about that...

mdamour
10-17-2006, 06:09 AM
Excellent! A better location for the mysql driver might be jboss/server/default/lib rather than on the endorsed path.

Oracle should work also, there is no reason for it not to. The "classes12.zip" should be put in the same place as your mysql driver.

For Oracle it is oracle.jdbc.driver.OracleDriver not oracle.jdbc.OracleDriver as far as I can tell. Your connect string looks good though.

For creating your cube schema you can try using our new Cube Design Wizard.

-Mike