wood burning stoves 2.0*
The moose likes JSP and the fly likes Prepares Statement : Shared Memory error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Prepares Statement : Shared Memory error" Watch "Prepares Statement : Shared Memory error" New topic
Author

Prepares Statement : Shared Memory error

vikram nalagampalli
Ranch Hand

Joined: Oct 08, 2001
Posts: 91
Hi all
i am trying to use the following Prepared statement for an Update statement. when i am executing this, SQL server 2000 gives me an error saying some shared memory.
The question is is it possible to use update query with prepared statement.
My code is as follows
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.lang.*" %>
<%@ page import="java.lang.String" %>
<%@ page import="java.io.*" %>
<%@ page import="resume1.Resume" %>
<%@ page session="true"%>
<jsp:useBean id="r"
class="resume1.Resume" scope="request"/>

<%String driver =
"sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc dbc:Resume";
String userId =
(String)session.getAttribute("Ssn");
Class.forName(driver);
Connection con=null;
try{
con=DriverManager.getConnection(url);


String st= "UPDATE resume SET
StreetAddress=?,City=?,State=?,Zip=?,Coun
try=?,Email=?,Phone=?,Fax=?,Objective=?,S
chool1=?,City1=?,State1=?,GraduationYear1
=?,Major1=?,Gpa1=?,School2=?,City2=?,Stat
e2=?,GraduationYear2=?,Major2=?,Gpa2=?,Em
ployerName1=?,JobTitle1=?,JobDescription1
=?,From1=?,To1=?,EmployerName2=?,JobTitle
2=?,JobDescription2=?,From2=?,To2=?,Emplo
yerName3=?,JobTitle3=?,JobDescription3=?,
From3=?,To3=?,platforms=?,programming=?,d
atabaseSkills=?,other=?,Activities=?,Achi
evements=?,Languages=?,Name1=?,Title1=?,C
ompanyName1=?,Address1=?,Phone1=?,Name2=?
,Title2=?,CompanyName2=?,Address2=?,Phone
2=?,Name3=?,Title3=?,CompanyName3=?,Addre
ss3=?,Phone3=? WHERE Ssn="+userId;

PreparedStatement
pstmt=con.prepareStatement(st);

pstmt.setString(1,r.getStreetAddress());
pstmt.setString(2,r.getCity());
pstmt.setString(3,r.getState());
pstmt.setString(4,r.getZip());
pstmt.setString(5,r.getCountry());
pstmt.setString(6,r.getEmail());
pstmt.setString(7,r.getPhone());
pstmt.setString(8,r.getFax());
pstmt.setString(9,r.getObjective());
pstmt.setString(10,r.getSchool1());
pstmt.setString(11,r.getCity1());
pstmt.setString(12,r.getState1() );
pstmt.setString(13,r.getGraduationYear1()
);
pstmt.setString(14,r.getMajor1() );
pstmt.setString(15,r.getGpa1() );
pstmt.setString(16,r.getSchool2());
pstmt.setString(17,r.getCity2() );
pstmt.setString(18,r.getState2() );
pstmt.setString(19,r.getGraduationYear2()
);
pstmt.setString(20,r.getMajor2() );
pstmt.setString(21,r.getGpa2() );

pstmt.setString(22,r.getEmployerName1()
);
pstmt.setString(23,r.getJobTitle1() );
pstmt.setString(24,r.getJobDescription1()
);
pstmt.setString(25,r.getFrom1() );
pstmt.setString(26,r.getTo1() );
pstmt.setString(27,r.getEmployerName2()
);
pstmt.setString(28,r.getJobTitle2() );
pstmt.setString(29,r.getJobDescription2()
);
pstmt.setString(30,r.getFrom2() );
pstmt.setString(31,r.getTo2() );
pstmt.setString(32,r.getEmployerName3()
);
pstmt.setString(33,r.getJobTitle3() );
pstmt.setString(34,r.getJobDescription3()
);
pstmt.setString(35,r.getFrom3() );
pstmt.setString(36,r.getTo3() );
pstmt.setString(37,r.getPlatforms() );
pstmt.setString(38,r.getProgramming() );
pstmt.setString(39,r.getDatabaseSkills()
);
pstmt.setString(40,r.getOther() );
pstmt.setString(41,r.getActivities() );
pstmt.setString(42,r.getAchievements() );
pstmt.setString(43,r.getLanguages() );
pstmt.setString(44,r.getName1() );
pstmt.setString(45,r.getTitle1() );
pstmt.setString(46,r.getCompanyName1() );
pstmt.setString(47,r.getAddress1() );
pstmt.setString(48,r.getPhone1() );

pstmt.setString(49,r.getName2() );
pstmt.setString(50,r.getTitle2() );
pstmt.setString(51,r.getCompanyName2() );
pstmt.setString(52,r.getAddress2() );
pstmt.setString(53,r.getPhone2() );

pstmt.setString(54,r.getName3() );
pstmt.setString(55,r.getTitle3() );
pstmt.setString(56,r.getCompanyName3() );
pstmt.setString(57,r.getAddress3() );
pstmt.setString(58,r.getPhone3() );
pstmt.executeUpdate();

pstmt.close();
pstmt=null;
}finally {

if(con!=null) {
con.close();
}
}
%>
<jsp:forward page="Welcome1.jsp"/>

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Prepares Statement : Shared Memory error
 
Similar Threads
Prepares Statement : No ResultSet was produced
Urrgent Pls Advice as soon as possible
Problem when Retreiving from DataBase
SQL syntax error
Need Help with check box values!