x

this is the program for thread in sql, plz check is it right or not

 import java.io.*;
 import java.sql.*;
 public class dk
 {
 public static void main(String[] args)throws IOException
 {
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 String rno,name,dept,mark;
 System.out.println("enter the value(rno,name,mark,dept)to be inserted");
 rno=br.readLine();
 name=br.readLine();
 mark=br.readLine();
 dept=br.readLine();
 int r1no=Integer.parseInt(rno);
 int mark1=Integer.parseInt(mark);
 try
 {
 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 Connection con=DriverManager.getConnection("jdbc:odbc:krmicro","scott","tiger");
 PreparedStatement st=con.prepareStatement("insert into newtable values(?,?,?,?)");
 st.setInt(1,r1no);
 st.setString(2,name);
 st.setInt(3,mark1);
 st.setString(4,dept);
 st.executeUpdate();
 }
 catch(Exception e)
 {
 System.out.println(e);
 }
 }
 }
more ▼

asked Sep 22, 2012 at 08:51 AM in Default

avatar image

Krv
-4 1 1 1

I am not a programmer in anyway, but have to tested it? If so does it work or if not what is the error?

Sep 22, 2012 at 09:57 AM sp_lock

@krv - please edit your question to make it clear what you would like assistance with or we will need to remove it from the forum.

Sep 22, 2012 at 04:10 PM Fatherjack ♦♦
(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x38
x8
x6

asked: Sep 22, 2012 at 08:51 AM

Seen: 762 times

Last Updated: Sep 22, 2012 at 04:10 PM

Copyright 2017 Redgate Software. Privacy Policy