5 Replies Latest reply on Mar 10, 2008 1:03 PM by david rehle

    howto change projects' database connection?

    david rehle Newbie

      hi everybody,

      i built a seamproject via new seam wizzard shipped with jboss tools.
      i used default databseconnection with hsqldb.

      now i want to change to postgresql and dont know how :-(

      i tried to rewrite the myproj-ds.xml,hibernate-console.properties and persitence.xml, but starting my application results in following exception:

      17:43:38,193 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
      17:43:38,265 INFO [SettingsFactory] RDBMS: PostgreSQL, version: 8.2.6
      17:43:38,266 INFO [SettingsFactory] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.3 JDBC3 with SSL (build 603)
      17:43:38,270 WARN [ServiceController] Problem starting service persistence.units:ear=myproj-ear.ear,jar=myproj-ejb.jar,unitName=myproj
      javax.persistence.PersistenceException: org.hibernate.HibernateException: Dialect class not found: org.hibernatÂe.dialect.PostgreSQLÂDialect
       at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)

      is there any possibility to change the settings run at creationtime of the project?
      when running new seamproject wizzard, i have to create a database connection, but where i can configure it later?

      any ideas are welcome


        • 1. Re: howto change projects' database connection?
          Max Rydahl Andersen Master

          sounds like the only thing you are missing is to put a postgresql jdbc driver in JBoss's lib directory.

          • 2. Re: howto change projects' database connection?
            david rehle Newbie

            hi, thanks for your reply

            i installd the correct jdbc driver. this is sure, because i can build a new sem web project and configure it for a postgresql connection. this works, i can see the correct datatables via pgadmin.
            i only want to change the settings for my hsqldb configured project.

            i built a new project with postgresql connection and had a look into the folder structure.
            in myproj/.settings are two files:


            i think that the databaseconnection is defined here, because the first file references a "seam.project.connection.profile=mypostgres" in mypostgresproject and "seam.project.connection.profile=myhsqldb" in myhsqldbproject

            but changing this value does not result in a correct database connection,nothing happens.

            the second file includes thousands of
            <FILESYSTEM ENTITY="FileSystemJar" ...

            but different in the two projects.

            and one contains the jdbc path (in configfile of myhsqldbproj)
            LOCATION="/.../jboss-4.2.2.GA/server/default/lib/postgresql-8.3-603.jdbc3.jar" NAME="lib-postgresql-8.3-603.jdbc3.jar"/>

            i am wondering why jboss tools does not provide a gui to switch to another databaseprofile?
            i dont want to copy all the sources from hsqldbproject to postgresproject, because of the packingstructure...

            any other ideas still welcome


            • 3. Re: howto change projects' database connection?
              david rehle Newbie

              the correct postgresql jdbc path is in postgresproject, not hsqldb project

              i found no possibility to edit a submitted post


              • 4. Re: howto change projects' database connection?
                Max Rydahl Andersen Master

                looking again on your stacktrace it looks like you have some additional characters in the driver classname - any chance you mistyped or have some weird encoding enabled on that file with the class name ?

                • 5. Re: howto change projects' database connection?
                  david rehle Newbie

                  oh my lord,

                  thanks max, now i can see it too :-(

                  my fault:
                  i copied the hibernate.dialect-propertyline from a internetpage in my browser to jboss tools, but eclipse showed the right syntax without any weird characters

                  i copied the line to a console an that gave me the following:


                  thus hibernate told me the right exception, because such a dialect is not available
                  i only was to blind, because the console ouput did not dispay the weird chars, but when creating my question here i copied the weird chars too :-)

                  anyway, it would be nice if jboss tools would provide a gui to change the databaseconnection like building a new seam project

                  properties->project facets->modify project... i went this way thousand times, this would be the right place

                  once again, thanks a lot max