This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes Validate SQL Queries Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Validate SQL Queries" Watch "Validate SQL Queries" New topic
Author

Validate SQL Queries

padmanabh dongre
Greenhorn

Joined: Aug 13, 2001
Posts: 24
Hi
Is there any way I can validate the syntax of an SQL query in java without actually executing it in the database ?

Regards,
Padmanabh
kundi kx
Greenhorn

Joined: Feb 03, 2003
Posts: 10
CHeck and see if your Database server has a SQL console you can use, and try your SQL there.
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

If you are needing the syntax to be checked in your program, look into Regular Rxpressions for checking the syntax. It's how compilers work.
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1112

Hi Padmanabh,
Asked (and answered -- by me) in this forum:
[Assumes you are using an Oracle database!]
http://www.coderanch.com/t/298353/JDBC/java/Compiling-SQL-statement-before-execute
Good Luck,
Avi.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Validate SQL Queries
 
Similar Threads
avoid sql injection
How to use Bind Variable with FROM and UPDATE clauses in PreparedStatement???
Specifying Table Name Dynamically in Insert Statement....
Java Lib to Validate SQL Query for Syntex
does OracleDriver really precompile a PreparedStatement?