Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9091

HCP binding non-default DBs

$
0
0

Hello,

I am attempting to create a java application in HCP that can connect to multiple HANA systems in the landscape. I am able to connect to one system using the default binding but when I try to retrieve a data source that I've named explicitly I get a NamingException (data source 'jdbc/dataSource1' is not available) when I do the JNDI lookup.

I have declared the DataSource in the web.xml file:

  <resource-ref>

    <res-ref-name>jdbc/dataSource1</res-ref-name>

    <res-type>javax.sql.DataSource</res-type>

  </resource-ref>

 

And my lookup code:

            InitialContext ctx = new InitialContext();

            Context envCtx = (Context) ctx.lookup("java:comp/env");

            DataSource ds = (DataSource) envCtx.lookup("jdbc/" + "dataSource1");

            return ds.getConnection();

 

And the I've defined the databinding between the java application and a hana instance on HCP. I'm not specifying a schema but instead supplying a username and password.

 

The binding works perfectly if I leave it as the default binding and change the web.xml and java to use DefaultDB instead of dataSource1. Am I missing a step to make the named bindings work? What could it be?

 

Thanks,

Steven


Viewing all articles
Browse latest Browse all 9091

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>