Results 1 to 9 of 9
  1. #1
    flyfisherman is offline Member
    Join Date
    Mar 2010
    Posts
    26
    Rep Power
    0

    Default 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)

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default

    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.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Tolls View Post
    I would ask why you don't simply use a stored procedure though.
    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.

  4. #4
    flyfisherman is offline Member
    Join Date
    Mar 2010
    Posts
    26
    Rep Power
    0

    Default

    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 :)

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default

    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?

  6. #6
    flyfisherman is offline Member
    Join Date
    Mar 2010
    Posts
    26
    Rep Power
    0

    Default

    It is a part of exam so the teacher wants to see SQL queries without SPs

    Thanks

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,009
    Rep Power
    20

    Default

    Then I suspect splurging them into one statement isn't really the idea either.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Tolls View Post
    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?
    I agreed. What's the point of avoiding SPs. I never recommended to avoid SPs.

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by flyfisherman View Post
    It is a part of exam so the teacher wants to see SQL queries without SPs

    Thanks
    I wonder what your teacher really wants to test. :p

Similar Threads

  1. Need smart solution on java game lag problem..
    By Addez in forum New To Java
    Replies: 0
    Last Post: 11-13-2009, 12:48 PM
  2. Be smart in English...
    By Eranga in forum Entertainment
    Replies: 22
    Last Post: 11-10-2009, 10:14 AM
  3. Multiple Queries using batch Updates
    By swati.jyoti in forum JDBC
    Replies: 3
    Last Post: 05-12-2009, 10:40 AM
  4. Smart Cache Loader 0.31
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 08-11-2007, 10:45 PM
  5. Smart Cache Loader 0.29
    By levent in forum Java Software
    Replies: 0
    Last Post: 07-26-2007, 08:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •