This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes CallableStatement  executeQuery Hangs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "CallableStatement  executeQuery Hangs" Watch "CallableStatement  executeQuery Hangs" New topic
Author

CallableStatement executeQuery Hangs

RajeshG Kumar
Greenhorn

Joined: Jul 10, 2007
Posts: 5
String sqlMain = "{CALL NCAPKG_PEAR_COMMON.NCASP_RECON_CREATE_PEAR(?, ?)}";
Connection conn = null;
conn = ResourceManager.getConnection(context);
CallableStatement cstmt = conn.prepareCall(sqlMain);
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.registerOutParameter(2, Types.VARCHAR);
Console.println("--> How nice? Let me execute the Query ..." );
cstmt.executeQuery();
Console.println("<-- done.");

Above is the code snippet.
The Moment it comes to executeQuery statements it hangs.

Can anybody tell me please what is wrong here?
If somebody faced similar kind of issue,please let me know.

Thank you
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
Welcome to JavaRanch.

Does the query finish if you run it directly in the DB, i.e. not using JDBC?


Ping & DNS - my free Android networking tools app
RajeshG Kumar
Greenhorn

Joined: Jul 10, 2007
Posts: 5
I have not tested without jdbc, but same program executes when I point it to other DB server.


Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

Rajesh,
Welcome to JavaRanch!

Since it works on another database server, that implies the problem is at the database end. Some things to try:
- running the query in the stored proc directly against the database [this is what Ulf suggested]
- checking if there are any locks held on the tables accessed by the stored proc
- recompiling the stored procedure on the troublesome server


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
RajeshG Kumar
Greenhorn

Joined: Jul 10, 2007
Posts: 5
Thank you.

I will try this and update.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: CallableStatement executeQuery Hangs
 
Similar Threads
DataDirect Driver : Error " [DataDirect][SQLServer JDBC Driver]Invalid parameter binding(s)"
invalid name patter error
Insertion Values not get stored in sql server using stored procdure in struts2
Exception calling Stored Procedure
How To Solve : java.sql.SQLException: Exhausted Resultset