store procedure

hi all, i'm new to jdbc. can anyone say me how to insert record into a table through stored procedure in sql sever 2000. this is the first time i'm using strore procedure. i can easily retrieve records from jdbc. i could not able to insert or update recs. plz help me with code related to it.

[301 byte] By [mikkua] at [2007-11-27 4:17:17]
# 1
using this codes:CallableStatement cs=con.prepareCall("{getData()}");ResultSet rs=cs.getExecuteQuery();
Rajesh3677a at 2007-7-12 9:23:54 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

hello rajesh tanxs 4 ur reply. but the code u told is for retrieving from database. but i asked abt inserting a record. however i found the soln.

//For Insert

CallableStatement cs=connect.prepareCall("{call addcourse(?,?,?)}");

cs.setString(1,courseId);

cs.setString(2,courseName);

cs.setInt(3,fees);

cs.executeUpdate();

//For Retrieval

CallableStatement stmt = conn.prepareCall("{call empprj}", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

try{

ResultSet rs = stmt.executeQuery();

while (rs.next())

{

String EmpName=rs.getString("EmpName");

String PrjName=rs.getString("PrjName");

System.out.print("EmpName: " + EmpName + "Project Name: " + PrjName);

}

System.out.println("RETRIEVED");

rs.close();

}

catch....

anyway thanx for ur intrest

regards

mikku

mikkua at 2007-7-12 9:23:54 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...