3 Replies Latest reply on Jun 2, 2014 9:32 AM by julien.topcu

    DataSource remote "lookup"

    julien.topcu Newbie

      Hello everyone,

       

      According to the Wildfly documentation, we are no longer able to perform remote JNDI lookup of an UserTransaction from the traditional way but we have to use now the new EJB Client API (through EJBClient.getUserTransaction("..")).

      I was wondering if Wildfly brings also this kind of limitation with the remote DataSource lookup : DataSource dataSource = (DataSource) context.lookup("jdbc/dataSourceName") ? And if so is there any other way to retrieve this through the new API ?

       

      Currently I am moving from JBOSS 4.2.3 GA, and I didn't find a way to retrieve a datasource from a remote EJB Client with WildFly 8.0.0.

       

      Here is my datasource configuration:

       

                      <xa-datasource jndi-name="java:/jdbc/dataSourceName" pool-name="dataSourceName" enabled="true" use-java-context="false">
                          <xa-datasource-property name="URL">
                              jdbc:mysql://localhost:3306/schema
                          </xa-datasource-property>
                          <driver>mysql5</driver>
                          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                          <xa-pool>
                              <min-pool-size>1</min-pool-size>
                              <max-pool-size>20</max-pool-size>
                          </xa-pool>
                          <security>
                              <user-name>user</user-name>
                              <password>***</password>
                          </security>
                          <validation>
                              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                              <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
                          </validation>
                      </xa-datasource>
      

       

      Thanks in advance!

        • 1. Re: DataSource remote "lookup"
          James Livingston Apprentice

          WildFly (and AS7) don't support remote datasource lookup, which I believe is a deliberate decision. If you used it on older versions where it worked, it was incredibly easy to create terrible performance problems, large server-side memory leaks, and more.

           

          What was the use case for having one? The best option is usually to encapsulate the data logic in an EJB which does the DB work server-side, and then call it from the client.

          • 2. Re: DataSource remote "lookup"
            David Lloyd Master

            James Livingston wrote:

             

            WildFly (and AS7) don't support remote datasource lookup, which I believe is a deliberate decision. If you used it on older versions where it worked, it was incredibly easy to create terrible performance problems, large server-side memory leaks, and more.

            This is correct, however I've been wondering whether it might be worthwhile to add this feature back once we finish the JNDI-based invocation API rework (http://lists.jboss.org/pipermail/wildfly-dev/2014-January/001457.html) in an upcoming WildFly release.  However instead of simply using RMI or an RMI-like exposure of the Connection or similar, we would employ something like http://vjdbc.sourceforge.net/ which would use a dedicated, optimized network protocol for the purpose.  What I'm not certain of is, how widely-used is this feature?  How desirable is it?  What about other use cases like providing remote access to an embedded database like H2 or Derby?  These are questions that would need to be answered before any such feature is re-introduced.

            • 3. Re: DataSource remote "lookup"
              julien.topcu Newbie

              Thanks every one for your answers, I'll manage it with a different way!