3 Replies Latest reply on Feb 26, 2008 9:05 PM by Nicklas Karlsson

    Datasource name

    marx3 Apprentice

      Hello
      Is it possible to know, which datasource uses server?
      I need to make some manual modifications in database via JDBC at startup of Seam application, so I want to use datasource to get connection.

        • 1. Re: Datasource name
          Nicklas Karlsson Master

          Marek Nazarko wrote on Feb 26, 2008 01:31 PM:


          Hello
          Is it possible to know, which datasource uses server?
          I need to make some manual modifications in database via JDBC at startup of Seam application, so I want to use datasource to get connection.


          I need some translation here ;-) Are you asking how to list what datasources are available to the server? Check the JNDI. If not, then the answer might not apply...

          • 2. Re: Datasource name
            marx3 Apprentice

            Application at start is bind to some datasource - entity manager uses it to persist etc. I want to know name of that datasource.
            It's written in xxx-ds.xml like
                   <jndi-name>xxxDatasource</jndi-name>

            • 3. Re: Datasource name
              Nicklas Karlsson Master

              Hmmm, I don't think there is any API for that. You could read your persistence.xml yourself and look through the deployed datasource-xml-files but there is probably something preventing you from reading files outside the ear/war(?)