Results 1 to 9 of 9
- 04-22-2010, 01:42 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
Multiple queries - is it smart to enable this
Hi there
In one method, I need to use more than one queries to the database.
(LOCK table; select ....; update.....; unlock....
I'm using prepared statements but is it smart to enable allowMultiQueries=true
Is this big impact on app security (SQL injection in the first place)
- 04-22-2010, 03:19 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Well, you say you;re using prepared statements, so SQL injection won't be a problem. Unless you're doing something really odd.
I would ask why you don't simply use a stored procedure though.
- 04-22-2010, 05:52 PM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I think this is the best solution you can take. Using stored procedures you can easily handle transactions in case of any error. For example say you want to do an insertion to the DB as well as update on DB. And the update fail, and if you want to rollback the insertion it's very easy to handle in SPs. There is no any impact on SQL injections as well.
- 04-22-2010, 08:09 PM #4
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
I was thinking to use stored procedures but it was asked from me to avoid them (and any other DB logic). Only standard sql queries...
Thanks :)
- 04-23-2010, 09:11 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
What requirement do you have that you think will be helped by multi queries (and avoiding SPs is just plain silly, frankly) rather than doing them separately?
- 04-23-2010, 11:36 AM #6
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
It is a part of exam so the teacher wants to see SQL queries without SPs
Thanks
- 04-23-2010, 11:43 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Then I suspect splurging them into one statement isn't really the idea either.
- 04-23-2010, 06:12 PM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 04-23-2010, 06:13 PM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
Need smart solution on java game lag problem..
By Addez in forum New To JavaReplies: 0Last Post: 11-13-2009, 12:48 PM -
Be smart in English...
By Eranga in forum EntertainmentReplies: 22Last Post: 11-10-2009, 10:14 AM -
Multiple Queries using batch Updates
By swati.jyoti in forum JDBCReplies: 3Last Post: 05-12-2009, 10:40 AM -
Smart Cache Loader 0.31
By JavaBean in forum Java SoftwareReplies: 0Last Post: 08-11-2007, 10:45 PM -
Smart Cache Loader 0.29
By levent in forum Java SoftwareReplies: 0Last Post: 07-26-2007, 08:09 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks