You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Shah, Chintan V (Chintan)" <cv...@lucent.com> on 2001/10/24 14:33:04 UTC

RE: How to put getRemoteAddr() into SQL server table in Tomcat 4. 0 ?

do it like this...it should work...

---------------------------------------------
............
............

if (rs.next())

String updateip ="Update tbluser set incomingip= '" +
request.getRemoteAddr() + "' where uname ='" + uname + "'";
-----------------------------------------------

Note the positions of apostrophe and double quotes... around
request.getRemoteAddr()

regards,
Chintan

-----Original Message-----
From: Miao, Franco CAWS:EX [mailto:Franco.Miao@gems7.gov.bc.ca]
Sent: Wednesday, October 24, 2001 10:48 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: How to put getRemoteAddr() into SQL server table in Tomcat 4.0
?


Source code:

---------------------------------------------
............
............

if (rs.next())

String updateip ="Update tbluser set incomingip= 'request.getRemoteAddr()'
where uname ='" + uname + "'";

-----------------------------------------------

No erro come up, but it didn't put remote Ip address into SQL server's
table, value is "null", if I change to "  '+request.getRemoteAddr()+'  ",
you will see
'+request.getRemoteAddr()+' as the value in SQL table.

Don't know why, looks like request.getRemoteAddr() doesn't function in SQL
statement. Pls advise, thanks!


Franco