12 Replies Latest reply on Jan 25, 2006 11:09 AM by noicangi

    Hibernate cfg, Connector, MySQL problem

    svaret Newbie

      Hi,

      I want to use MySQL 4.1.8 with my jboss-portal-2.0.1-jboss-4.0.3SP1 installation.

      In the hibernate config file located in server\default\deploy\jboss-portal.sar\conf\hibernate I have added the following line:
      org.hibernate.dialect.MySQLDialect.

      I have placed the jar-file called mysql-connector-java-3.1.12-bin.jar under the directory server\default\lib.

      I have placed the file portal-mysql-ds.xml in directory server\default\deploy. The file looks like this:
      <?xml version="1.0" encoding="UTF-8"?>

      <local-tx-datasource>
      <jndi-name>PortalDS</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false</connection-url>
      <driver-class>org.gjt.mm.mysql.Driver</driver-class>
      <user-name>portal</user-name>
      portalpassword
      </local-tx-datasource>
      <no-tx-datasource>
      <jndi-name>NoTxPortalDS</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false</connection-url>
      <driver-class>org.gjt.mm.mysql.Driver</driver-class>
      <user-name>portal</user-name>
      portalpassword
      </no-tx-datasource>


      Upon starting Jboss AS with Portal bundled I get the confusing log message:
      13:37:00,086 INFO [DatasourceConnectionProvider] Using datasource: java:PortalDS
      13:37:00,337 INFO [SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
      13:37:00,337 INFO [SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
      13:37:00,377 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect


      Driver used is HSQL but it has recognized that I am using MySQL.

      I then get errors when Database Content is about to be created:
      13:37:01,919 INFO [DatasourceConnectionProvider] Using datasource: java:PortalDS
      13:37:01,919 ERROR [SchemaExport] Unsuccessful: create table jbp_roles (jbp_rid integer not null auto_incremen
      t, jbp_name varchar(255) unique, jbp_displayname varchar(255) unique, primary key (jbp_rid))
      13:37:01,919 ERROR [SchemaExport] Unexpected token: AUTO_INCREMENT in statement [create table jbp_roles (jbp_r
      id integer not null auto_increment]
      13:37:01,919 ERROR [SchemaExport] Unsuccessful: create table jbp_user_pref (jbp_id integer not null auto_incre
      ment, jbp_name varchar(255) not null, jbp_type integer, jbp_set_id integer, primary key (jbp_id))
      13:37:01,919 ERROR [SchemaExport] Unexpected token: AUTO_INCREMENT in statement [create table jbp_user_pref (j
      bp_id integer not null auto_increment]
      13:37:01,919 ERROR [SchemaExport] Unsuccessful: create table jbp_user_pref_set (jbp_id integer not null auto_i
      ncrement, jbp_parent_id integer, name varchar(255) not null, primary key (jbp_id))
      13:37:01,919 ERROR [SchemaExport] Unexpected token: AUTO_INCREMENT in statement [create table jbp_user_pref_se
      t (jbp_id integer not null auto_increment]
      .

      What am I doing wrong? Very grateful for any suggestions.

      Best regards

      Lasse