Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    MySQL Datasource

    I'm trying to hook up a MySQL data source. I have it working and setting up the DB connection. I verified that the connection works using Spring and getting the db connection from JNDI. However, when I try and load a ds.xml, I get this error:

    Code:
    java.sql.SQLException: java.lang.ClassNotFoundException: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
    I'm not sure why it's trying to load the MySQL driver, I've been using MariaDB. Here's my server.properties:

    Code:
    sql.defaultDatabase.jndi.publish.path:isomorphic/jdbc/defaultDatabase
    # If you want to use Mysql instead, uncomment the following line
    # and comment all other sql.defaultDatabase definitions
    sql.defaultDatabase:Mysql
    sql.defaultDatabase.type:mysql
    sql.defaultDatabase.interface.type:dataSource
    sql.defaultDatabase.driver:org.mariadb.jdbc.MariaDbDataSource
    sql.defaultDatabase.driver.serverName:${db.host}
    sql.defaultDatabase.driver.portNumber:3306
    sql.defaultDatabase.driver.databaseName:${db.name}
    sql.defaultDatabase.driver.user:${db.user}
    sql.defaultDatabase.driver.password:${db.password}
    And my ds.xml

    Code:
    <DataSource ID="Customer"
                serverType="sql"
                tableName="customer"
                autoDeriveSchema="true">
    </DataSource>
    Is there a configuration that I'm missing to tell it to use the correct driver?

    #2
    Change your configuration to:

    Code:
    sql.defaultDatabase:Mysql
    sql.Mysql.type:mysql
    sql.Mysql.interface.type:dataSource
    sql.Mysql.driver:org.mariadb.jdbc.MariaDbDataSource
    sql.Mysql.driver.serverName:${db.host}
    sql.Mysql.driver.portNumber:3306
    sql.Mysql.driver.databaseName:${db.name}
    sql.Mysql.driver.user:${db.user}
    sql.Mysql.driver.password:${db.password}
    Note that the name 'Mysql' that is used as the defaultDatabase name above is just a symbolic name used to select the configuration block. You could call it whatever you want.

    Comment


      #3
      Thank you, that worked.

      Comment

      Working...
      X