pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgresql.stat.result
4+ messages / 2 participants
[nested] [flat]
* postgresql.stat.result
@ 2005-08-03 06:05 Minal <minalac@yes2etl.com>
0 siblings, 2 replies; 4+ messages in thread
From: Minal @ 2005-08-03 06:05 UTC (permalink / raw)
To: pgsql-jdbc
hi....
I am calling a function using the following JSP code...my function name
is "sp_login". As every function is supposed to return something...my
function returns 1, on completion of the task....I am getting the
following error..
org.apache.jasper.JasperException: postgresql.stat.result
The jsp code is as follows:
Can someone help me????
sql="SELECT sp_login ('INSERT','admin','"+username+"','"+password+"')";
//sql="INSERT INTO USERS (USERTYPE,USERNAME,PASSWORD) VALUES
('admin','"+username+"','"+password+"')";
pStat=conn.prepareStatement(sql);
msg=pStat.executeUpdate();
out.println(msg);
if(msg==1)
{%>
<jsp:forward page="message_user.jsp?done=yes&action=add"/>
<%}
else
{%>
<jsp:forward page="message_user.jsp?done=no&action=add"/>
<%}
}%>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgresql.stat.result
@ 2005-08-03 06:38 Oliver Jowett <oliver@opencloud.com>
parent: Minal <minalac@yes2etl.com>
1 sibling, 0 replies; 4+ messages in thread
From: Oliver Jowett @ 2005-08-03 06:38 UTC (permalink / raw)
To: Minal <minalac@yes2etl.com>; +Cc: pgsql-jdbc
Minal wrote:
> org.apache.jasper.JasperException: postgresql.stat.result
(this must be a fairly old driver, but..)
> sql="SELECT sp_login ('INSERT','admin','"+username+"','"+password+"')";
> //sql="INSERT INTO USERS (USERTYPE,USERNAME,PASSWORD) VALUES
> ('admin','"+username+"','"+password+"')";
> pStat=conn.prepareStatement(sql);
> msg=pStat.executeUpdate();
You must use executeQuery() to execute SQL that returns a result. Per
the JDBC javadoc, if you use executeUpdate() to run a query that returns
a ResultSet, the driver should throw a SQLException.
-O
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgresql.stat.result
@ 2005-08-03 07:01 Oliver Jowett <oliver@opencloud.com>
parent: Minal <minalac@yes2etl.com>
1 sibling, 1 reply; 4+ messages in thread
From: Oliver Jowett @ 2005-08-03 07:01 UTC (permalink / raw)
To: Minal <minalac@yes2etl.com>; +Cc: pgsql-jdbc
Minal wrote:
> sql="SELECT sp_login ('INSERT','admin','"+username+"','"+password+"')";
> //sql="INSERT INTO USERS (USERTYPE,USERNAME,PASSWORD) VALUES
> ('admin','"+username+"','"+password+"')";
> pStat=conn.prepareStatement(sql);
On another topic, either you need to ensure that username/password are
correctly escaped, or you should use '?' placeholders and use
setString() to set them. Otherwise you have a SQL injection hole there.
-O
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: postgresql.stat.result
@ 2005-08-03 08:30 Minal <minalac@yes2etl.com>
parent: Oliver Jowett <oliver@opencloud.com>
0 siblings, 0 replies; 4+ messages in thread
From: Minal @ 2005-08-03 08:30 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc
Thanks are you aqare of any books on JSP-POSTGRES
Oliver Jowett wrote:
>Minal wrote:
>
>
>
>>sql="SELECT sp_login ('INSERT','admin','"+username+"','"+password+"')";
>>//sql="INSERT INTO USERS (USERTYPE,USERNAME,PASSWORD) VALUES
>>('admin','"+username+"','"+password+"')";
>> pStat=conn.prepareStatement(sql);
>>
>>
>
>On another topic, either you need to ensure that username/password are
>correctly escaped, or you should use '?' placeholders and use
>setString() to set them. Otherwise you have a SQL injection hole there.
>
>-O
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2005-08-03 08:30 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-03 06:05 postgresql.stat.result Minal <minalac@yes2etl.com>
2005-08-03 06:38 ` Oliver Jowett <oliver@opencloud.com>
2005-08-03 07:01 ` Oliver Jowett <oliver@opencloud.com>
2005-08-03 08:30 ` Minal <minalac@yes2etl.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox