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.
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
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.