Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

Issues connecting to MaxDB using HCP

$
0
0

Hi,

 

We have deployed a JAVA application in HCP in Java EE 6 Web Profile runtime.We are trying to create and read data from a MaxDB instance bound to the JAVA application(with default binding).

 

We are able to create DBConnection with the MaxDB instance,but we are the getting the following exception on trying to create a prepareStatement:


2016 05 17 10:03:34#+00#INFO#System.out##P000226#http-bio-8041-exec-7#na#spltest#captcha#web#spltest#Borrow prepareStatement from pool failed

 

Are we missing something here?Kindly help us with this. Thanks

 

Following  are the implementation details

 

 

Code to read data

try{

String a = null;

InitialContext ctx = new InitialContext();

DataSource dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/DefaultDB");

Connection conn = dataSource.getConnection();

PreparedStatement pstmt = conn.prepareStatement("Select '1' as \"ABC\" from dummy");

ResultSet rs = pstmt.executeQuery();

while (rs.next()){

a=rs.getString(1);

System.out.println(a+"result printed from dummy");

}

rs.close();

pstmt.close();

 

} catch(Exception e){

System.out.println(e.getMessage());

}

 

Resource reference in web.xml

<resource-ref>

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

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

</resource-ref>


Viewing all articles
Browse latest Browse all 3363

Trending Articles



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