top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between Statement and PreparedStatement interface?

0 votes
553 views
What is the difference between Statement and PreparedStatement interface?
posted Jan 13, 2016 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Statement
Use the for general-purpose access to your database. Useful when you are using static SQL statements at runtime. The Statement interface cannot accept parameters.
PreparedStatement
Use the when you plan to use the SQL statements many times. The PreparedStatement interface accepts input parameters at runtime.

answer Jan 20, 2017 by Dhaval Vaghela
Similar Questions
+1 vote
public class example 
{
     int i[] = {0};
         public static void main(String args[])
    {
         int i[] = {1};
          change_i(i);
          System.out.println(i[0]);
      }
      public static void change_i(int i[]) 
       {
         i[0] = 2;
         i[0] *= 2;
      }
}
+1 vote
class test
 {
    static boolean check;
    public static void main(String args[])
   {
        int i;
        if(check == true)
            i=1;
        else
            i=2;
        if(i=2) i=i+2;
        else i = i + 4;
        System.out.println(i);
     }
}
...