5 Replies Latest reply on Oct 14, 2005 10:50 AM by ray lukas

    how to switch Portal database?

    Bruce Newbie

      I read jBossPortal User Guide.
      I was told to config a portal-*-ds.xml file, and put corresponding JDBC driver at server/default/lib folder.
      I have below questions:
      1. what is the naming rule for portal-*-ds.xml. Can I replace * with any string?
      2. how can I change portal database to MS sql server or other database through JDBC:ODBC driver? Can anyone give me a step by step description? Thanks.

        • 1. Re: how to switch Portal database?
          Bruce Newbie

          I have sucessfully changed the portal database to MS sql server. The user guide is OK.

          • 2. Re: how to switch Portal database?
            ray lukas Newbie

            So did what did you call the file? Bruce is asking what the file name should be. Could you take a peek at your server/default/deploy dir and simply type in the file name for him, and us.
            Can that * be just any string?
            Were there any other changes that you had to make to get MS SQL Server Working?


            Thanks..

            • 3. Re: how to switch Portal database?
              Bradley Smith Master

              In your portal-ds.xml (you can just edit the original - no need to rename file, create new file, etc...)

              You should change the XML to something like this:

              <no-tx-datasource>
               <jndi-name>PortalDS</jndi-name>
               <connection-url>jdbc:jtds:sqlserver://YOUR_DB_SERVER_HOST:1433/YOUR_DATABASE;SelectMethod=Cursor</connection-url>
               <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
               <user-name>your-portal-DB-user</user-name>
               <password>your-portal-DB-password</password>
              </no-tx-datasource>
              


              NOTE - I used the jTDS(open source) JDBC Driver for MS SQL Server/Sybase. You MUST use PortalDS as the jndi-name of your data source.

              You may need to tweak the hibernate config file for the portal at:

              ${JBOSS_HOME}\server\default\deploy\jboss-portal.sar\conf\hibernate\hibernate.cfg.xml

              and manually set the SQL dialect to

              org.hibernate.dialect.SQLServerDialect

              Chances are that the portal will automatically sense the dialect for you though.


              Some suggestions

              - avoid using the JDBC:ODBC Driver, instead use a pure Java (Type IV) JDBC Driver
              - you can use any file name you want as long as it ends in -ds.xml, however, there's not too much advantage in doing so because you must use a datasource named PortalDS for the portal to work.

              Hope this helps.


              • 4. Re: how to switch Portal database?
                Bruce Newbie

                Thank Smith and rya_lukas. Your replies are so helpful. I failed to change the Portal database at first because I did not config higernate.cfg.xml, the hibernate dialect is not correctly configured. After I configured the hibernate.cfg.xml, everyghing become OK.
                Thanks again.

                • 5. Re: how to switch Portal database?
                  ray lukas Newbie

                  For PostgreSql, which is what I am using in the Jboss example. I created a file called portal-hibernate-ds.xml although I am pretty sure as was hinted to about I could have, and I should have, called it portal-postgresSQL-ds.xml. And it worked great.. So as long as the file looks like portal-*-ds.xml you should be all set.
                  I also put the postgresql-8.0-311.jdbc3.jar file (there might be a newer version) in the C:\jboss-portal-2.0-jboss-4.0.2\server\default\lib directory and everything worked great..

                  Here is a copy of my portal-hibernate-ds.xml file if that is any help. Maybe there are other PostgreSql users out there..

                  <?xml version='1.0' encoding='utf-8'?>


                  <local-tx-datasource>
                  <jndi-name>PortalDS</jndi-name>
                  <connection-url>jdbc:postgresql:jbossportal</connection-url>
                  <driver-class>org.postgresql.Driver</driver-class>
                  <user-name>portal</user-name>
                  portalpassword
                  </local-tx-datasource>