Abhishek Bharti

Greenhorn
+ Follow
since May 18, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Abhishek Bharti

Thanks a lot Jan,

I will study about the connection caching and pooling as i do not have much idea about it.


Thanks again,

Abhishek
Thank Jan,

I really got the idea that even in case of prepared statements everything happens at runtime , only the compilation takes place for one time , but in simple statements validation, compilation and execution takes place each time we execute the statement.


How can we deal with the dynamic queries in case of prepared statements as the query string will be compiled only once.


Thanks,

Abhishek
Thanks a lot Jan,

i still have a confusion why no exception was thrown at this line

PreparedStatement statement = conn.prepareStatement(" Selec * from temp ");

as query string has error it should throw some exception, or the query string is compiled at once only a PreparedStatement is executed for the first time....

Thanks,

Abhishek
[ April 27, 2007: Message edited by: Abhishek ]
Hi,

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("URL","USER","PASS");
PreparedStatement statement = conn.prepareStatement(" Selec * from temp ");
SQLWarning warning = statement.getWarnings();
System.out.println("warning : "+warning);
ResultSet set = statement.executeQuery();

I am using the above code to use a PreparedStatement. Here we can see that the Query has the syntax error. But the code throws the exception after i execute the statement. I have idea about the PreparedStatement that it precompiles the SQL query string passed, if it does then it should throw the exception at the time when we call prepareStatement method from connection. Or this precompilation depends upon the driver?

Abhishek
Are you sure you have not copy n paste the code while trying on IDE, try by typing through keyboard or something. This must be your system specific problem.
hi Deepthi,

Is it throwing some exception...if it is then please let us know. that would be easier for us to find out a solution...

Abhishek