tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Moss" <billm...@hotmail.com>
Subject DBTags insert weirdness, sybase
Date Thu, 29 Nov 2001 20:49:28 GMT
I'm having problems inserting to a Sybase ASA 6 DB. I'm using v1.0 DBTags, 
Tomcat 4.1, jconn2, and Sybase ASA 7 running a 6.0 db file (all on Win2k).

I have a form which uses DBTags to populate various select boxes, it does 
this well. The form uses one connection which is closed at the end of the 
form. The form posts to a page that opens another connection, processes the 
data using an insert SQL statement with getParameters to populte the values 
to insert. The form parameters are getting passed. The problem is that:

The db only seems to hold 2 or 3 rows. The first form post works. The second 
one sometimes works, a third post will replace the second row. A third post 
will delete the previous two and it will be the only row. But then I'll be 
able to post 3 times, etc. I'm using an idenity column for id which is the  
primary key (identity is like auto increment). Is there some weird caching 
going on...

Help!

Thanks,
Bill

my processor page follows:

<%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags" prefix="sql" %>

<sql:connection id="conn2">
	<sql:url>jdbc:sybase:Tds:localhost:2638/Mooky</sql:url>
	<sql:driver>com.sybase.jdbc2.jdbc.SybDriver</sql:driver>
	<sql:userId>dba</sql:userId>
	<sql:password>sql</sql:password>
</sql:connection>


First: <%=request.getParameter("fname")%> <br>
Middle: <%=request.getParameter("mname")%> <br>
Last: <%=request.getParameter("lname")%> <br>
Age: <%=request.getParameter("age")%> <br>
Unit: <%=request.getParameter("unit")%> <br>
Gender: <%=request.getParameter("gender")%> <br>
Subtype: <%=request.getParameter("stype")%> <br>
Position: <%=request.getParameter("pos")%> <br>
Condition: <%=request.getParameter("cond")%> <br>
Description: <%=request.getParameter("descr")%> <br>
Reported to Attending: <%=request.getParameter("rtat")%> <br>
Reported to Nursing: <%=request.getParameter("rtnu")%> <br>
Reported to Pharmacy: <%=request.getParameter("rtph")%> <br>
Reported to Admin: <%=request.getParameter("rtad")%> <br>


<%-- insert a row into the database --%>
<sql:statement id="stmt1" conn="conn2">
  <%-- set the SQL query --%>
  <sql:query>

insert into holding (fname, mname, lname, age, unit, gender, stype, pos, 
cond, descr, rtat, rtnu, rtph, rtad) values

(

'<sql:escapeSql><%=request.getParameter("fname")%></sql:escapeSql>',
'<sql:escapeSql><%=request.getParameter("mname")%></sql:escapeSql>',
'<sql:escapeSql><%=request.getParameter("lname")%></sql:escapeSql>',

<%=request.getParameter("age")%>,
<%=request.getParameter("unit")%>,
<%=request.getParameter("gender")%>,
<%=request.getParameter("stype")%>,
<%=request.getParameter("pos")%>,
<%=request.getParameter("cond")%>,

'<sql:escapeSql><%=request.getParameter("descr")%></sql:escapeSql>',

<%=request.getParameter("rtat")%>,
<%=request.getParameter("rtnu")%>,
<%=request.getParameter("rtph")%>,
<%=request.getParameter("rtad")%>



)
  </sql:query>
  <%-- execute the query --%>
  <sql:execute/>
</sql:statement>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message