3 Replies Latest reply on Nov 16, 2015 9:29 AM by Ramesh Reddy

    connect vdb by jndi name from hibernate

    Prashanthi Kairuppala Novice

      Hi,

      i am able to connect to a VDB from hibernate by giving the vdb connection details in hibernate.config file.

      I am trying to connect by JNDI name, but i get  "org.hibernate.engine.jndi.JndiException: Error parsing JNDI name" and " javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial" errors.

       

      below is my config file

                        <property name="hibernate.hbm2ddl.auto">update</property> 

                        <property name="hibernate.dialect">org.teiid.dialect.TeiidDialect</property>

                        <property name="hibernate.connection.datasource">java:comp/env/jdbc/userDS</property>  

                        <property name="hibernate.connection.driver_class">org.teiid.jdbc.TeiidDriver</property>

                        <property name="hibernate.order_updates">true</property>

       

      My datasource in standalone.xml file is as below:

      <datasource jndi-name="java:/userDS" pool-name="userDS" enabled="true">

                  <connection-url>jdbc:teiid:userVDB@mm://localhost:8080;user=user;password=user</connection-url>

                          <driver>teiid</driver>

                          <security>

                              <user-name>user</user-name>

                              <password>user</password>

                          </security>

                      </datasource>

             

      Do i need to make any settings changes to make a successfull connection?

       

      thanks in advance,

      Prashanthi