Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: how to set jdbc properties on Mondrian's xmla datasources.xml

  1. #1
    Join Date
    Jul 2010
    Posts
    11

    Default how to set jdbc properties on Mondrian's xmla datasources.xml

    I'm getting ? instead of unicode characters in my resultsets from mondrian via xmla. My problem is similar to the one described in this post:
    http://lists.pentaho.org/pipermail/m...er/002136.html

    The solution described in the previous post says to set some jdbc properties on the connection url.
    Now I add "useUnicode=true&characterEncoding=UTF-8" in my JDBC data source connection, and it works like a charm!
    However, the datasources.xml for that connection won't accept url params. Instead the mondrian documentation suggests that i should be able to do this in my datasources.xml using properties with the prefix "jdbc.*"
    http://mondrian.pentaho.com/document...ing_properties

    It doesn't seem to have any affect. Here's an excerpt from my WEB-INF/datasources.xml:
    Code:
    <DataSourceInfo>Provider=Mondrian; Jdbc=jdbc:mysql://localhost/mydb; jdbc.useUnicode=true; jdbc.characterEncoding=UTF-8; jdbc.characterSetResults=UTF-8; JdbcUser=myuser; JdbcPassword=mypass; JdbcDrivers=com.mysql.jdbc.Driver;</DataSourceInfo>
    Can anyone see why Mondrian wouldn't use these "jdbc.*" properties?

    I can tell it's not using it I've turned on mondrian sql debugging and i can see it looking up the member by name using ? instead of unicode.

  2. #2
    Join Date
    Dec 2009
    Posts
    609

    Default

    Hi,

    maybe I use a more complicated approach, but usually I do the following:
    - create a JNDI-Datasource from PAC
    - make mondrian use the JNDI-Datasource

    From inside the PAC you are required to specify the JDBC-URL, thus this is the most obvious point where your properties could/should go to...

    What do you think about this approach?

    HTH,

    Tom

  3. #3
    Join Date
    Jul 2010
    Posts
    11

    Default

    Thanks for the reply Tom. I'm actually using Mondrian deployed to Tomcat, so i don't have a full Pentaho installation. However i like the idea of using a JNDI datasource. I've got one configured for jpivot that i think i can reuse. I'll let you know how it goes.

  4. #4
    Join Date
    Jul 2010
    Posts
    11

    Default

    Cool. The ultimate solution was to configure the DefaultXmlaServlet to use UTF-8 encoding
    Code:
      <servlet>
        <servlet-name>MondrianXmlaServlet</servlet-name>
        <servlet-class>mondrian.xmla.impl.DefaultXmlaServlet</servlet-class>
        <init-param>
            <param-name>CharacterEncoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
      </servlet>
    Got that from this post:
    http://forums.pentaho.com/archive/in...p/t-70952.html

    But i also took your advice on using a JNDI datasource. I liked the idea of having only one definition for my datasource.

    My datasources.xml now simply refers to the same jndi connection i set up for jpivot
    Code:
    <DataSourceInfo>Provider=Mondrian;DataSource=java:comp/env/jdbc/yield;</DataSourceInfo>
    My context.xml looks like this:
    Code:
    <Context reloadable="false" crossContext="false" path="/Mondrian">
    
      <Resource name="jdbc/yield" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="180000"
               username="myuser" password="mypass" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/mydb?useUnicode=true&amp;characterEncoding=UTF-8&amp;characterSetResults=UTF-8"/>
        
    </Context>
    Thanks for the help!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.