6 Replies Latest reply on Jun 7, 2003 3:54 PM by shortpasta

    1 jar, 2 databases, jbosscmp-jdbc.xml?

    shortpasta

      I am deploying my application with a mysql-specific jbosscmp-jdbc.xml which is placed in the META-INF folder.

      What should I do to support a new database, like mssql?

      Should i deploy multiple versions of the jar such as myjar-mysql.jar and myjar-mssql.jar each with a db-specific jbosscmp-jdbc.xml?

        • 1. Re: 1 jar, 2 databases, jbosscmp-jdbc.xml?

          deploy your bean twice under different jndi names and map the ejb names to different datasources in jbosscmp-jdbc.xml

          • 2. Re: 1 jar, 2 databases, jbosscmp-jdbc.xml?
            shortpasta

            my app only needs to run against 1 database, either mysql OR mssql.

            when someone installs my app, the installer CAN setup the app for a given database, by deploying the mssql-version of my jar instead of the mysql-version.

            i wish there were a way to deploy one jar somehow with many jbosscmp-jdbc.xml, setup for all databases, similar to the Resource Bundle concept:
            resource_en is for english
            resource_es is for spanish
            ... and so forth... they're all deployed together, and the app-server picks the right one at runtime in function of the browser's preferred locales.

            • 3. Re: 1 jar, 2 databases, jbosscmp-jdbc.xml?

              so how would the app server choose which database configuration to use?

              • 4. Re: 1 jar, 2 databases, jbosscmp-jdbc.xml?
                shortpasta

                it would be intrinsic in the deployment:

                the app-server would knows only about 1 datasource.

                i would accomplish this by deploying only 1 of:
                mysql-ds.xml
                -or-
                mssql-ds.xml

                both bound to "java:/DefaultDS".

                • 5. Re: 1 jar, 2 databases, jbosscmp-jdbc.xml?

                  I'm not sure I'd like that type of implicit behavior -- would seem it is far too easy to connect to the WRONG database and do some damage there.

                  I rather explicitly bound my datasources to specific names other than DefaultDS.

                  • 6. Re: 1 jar, 2 databases, jbosscmp-jdbc.xml?
                    shortpasta

                    Not at all from my point of view:

                    remember that my system has to connect to 1 database, either mysql -or- mssql. in this situation the uniform datasource name allows me to deploy both datasource descriptors, and even if a configuration mistake is made one of the datasources will fail indicating that the jndi name is already in use.

                    furthermore i deploy the datasources with generic db name/username/password, so the chance of anybody in the world picking my same combination is nil.

                    but my issue is not how to deploy the datasources, it is on howto deploy the ejb modules that contain jbosscmp-jdbc.xml in a similar fashion.

                    if noone has any better approach i will deploy 2 jars: each with a jbosscmp-jdbc.xml for that specific database. i only wish that there was a way i didn't have to create a full jar that way, after all the only difference is the 1 xml file (unless some surprise comes later).