Search code examples
websphereibm-mobilefirst

WL6.1 Deploying sql adapter with dataSourceJNDIName give error Runtime: Datasource not found in jndi


i am deploying an sql adapter on was liberty 8.5.5. i'm trying to connect to the APPCNTR database installed with WL. the datasource name declared in server.xml :

  <dataSource jndiName="jdbc/AppCenterDS" transactional="false">
         <jdbcDriver libraryRef="MySQLLib"/>
         <properties URL="jdbc:mysql://127.0.0.1:3306/APPCNTR" user="ibmappcenter" password="xxxx"/>
    </dataSource>

the adapter xml :

<connectivity>
        <connectionPolicy xsi:type="sql:SQLConnectionPolicy">
                <dataSourceJNDIName>java:comp/env/jdbc/AppCenterDS</dataSourceJNDIName>
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="5" />
     </connectivity>

the error in javascript console : Runtime: Datasource java:comp/env/jdbc/AppCenterDS not found in jndi what is the correct syntax ? do i miss something while deploying the application? thanks for your help regards,


Solution

  • I know that the generated files has

    <dataSourceJNDIName>java:/data-source-jndi-name</dataSourceJNDIName> 
    

    as the model, but I've never been able to get that to work. It should work with the simple name:

    <dataSourceJNDIName>jdbc/AppCenterDS</dataSourceJNDIName>