Re: Dynamic Sql Statement in SP
Posted by:
Ming Yeung
Date: January 10, 2006 06:51AM
> No, this should not be a problem. User variables
> exist in the session scope: one session can see
> all the user variables it has created - not the
> ones created in other sessions.
I tested this with Java Struts & DBCP (Connection Pool). It seems to me there might be a serious matter when using user variables. I added the code to my SP for the test:
...
IF @SqlString IS NOT NULL THEN
SELECT @SqlString as sqlStatement;
LEAVE SP_MAIN;
END IF;
...
PREPARE STMT FROM @SqlString;
...
I believe the sessions of the MySql user are not being released, the connections are all being returned to the Pool. Therefore, user variables are accessed by different web users(All web users use the same MySql account 'ming').
I haven't tested it without connection pooling. But as I have seen that it is really a matter to web applications when using connection pooling. Web user 'A' might get the result of web user 'B', and user 'B' might get errors as the result is being free, etc.
Please prove that I'm wrong, I really want to continue using SP with MySql.
> This is dangerous! A user can, either knowingly or
> unknowlingly, inject it's own SQL inside your
> statement. Suppose your user passes this value for
> inUsername:
Oh yes, Thank for reminding me.
Thanks.
Ming
Edited 1 time(s). Last edit at 01/10/2006 06:52AM by Ming Yeung.
Subject
Views
Written By
Posted
2924
January 09, 2006 06:22AM
1584
January 09, 2006 08:06AM
1311
January 09, 2006 02:10PM
1889
January 09, 2006 08:02PM
1765
January 10, 2006 12:24AM
1581
January 10, 2006 03:07AM
Re: Dynamic Sql Statement in SP
1784
January 10, 2006 06:51AM
1490
January 10, 2006 01:49PM
1842
January 10, 2006 06:35PM
1640
January 10, 2006 07:22PM
1726
January 10, 2006 10:33PM
1735
January 11, 2006 03:10AM
2291
January 11, 2006 04:27AM
1726
January 11, 2006 06:54AM
1579
January 11, 2006 03:34PM
1753
January 11, 2006 03:56PM
1747
January 12, 2006 03:20AM
1533
January 12, 2006 04:44AM
1518
January 11, 2006 09:08PM
1754
January 12, 2006 03:11AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.