aspose file tools*
The moose likes JDBC and the fly likes how to execute complex queries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to execute complex queries" Watch "how to execute complex queries" New topic
Author

how to execute complex queries

Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
hai all,
I wrote a app where i will give complex sql queries which may contain several joins. my program works with simple sql queries but throws exception when i give this complex quries. then how to solve this prob.
I use createStatement() method.
one more thing is when & how to use callablestatements?
bye
siva.


Regards,
Sivaraman.L
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Well, concerning your complex query issue, without seeing:
1. The Code
2. The error message
I would have no idea what your problem is.
And to answer your other question, CallableStatement are used to call Stored Procedures. See The JDBC Tutorial-Stored Procedures


GenRocket - Experts at Building Test Data
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

CallableStatement is used to call stored procedures on the database. You are probably better served by Statement (for one-use calls) or PreparedStatement (for often-used queries). The first step in debugging a SQL query is making sure the query is correct SQL. Try to run the query in the database (i.e. MS Sql Server Enterprise Manager or Oracle SQL Plus console). If the query works in the database but not in your Java code then the problem is somewhere in your program. That should get you started.


[How To Ask Questions On JavaRanch]
 
 
subject: how to execute complex queries