Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to execute complex queries

 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joe Ess
Bartender
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic