Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: how to execute multiple different queries in one execute?

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to execute multiple different queries in one execute?

    I want to execute the multiple queries or job in one execute. Something like this eg:


    String query="select * from tab1;insert into tab1 values(...);update tab1..;delete from tab1...;"  
    Statement st = con1.createStatement();  
    ResultSet rs = st.executeQuery(query);



    Or multiple select queries.Queries will be dynamic.

    But I am not able to do this.What is the way to run multiple queries separated by semi colon.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: how to execute multiple different queries in one execute?

    Please be forthright when crossposting.

    This thread has been cross posted here:

    http://www.coderanch.com/t/583575/java/java/execute-multiple-different-queries-one

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. Why my void run method cannot be execute?
    By 90th century in forum Threads
    Replies: 2
    Last Post: March 30th, 2012, 12:09 PM
  2. [SOLVED] .jar file won't execute
    By pajfilms in forum What's Wrong With My Code?
    Replies: 27
    Last Post: August 3rd, 2011, 07:43 PM
  3. Could not execute the file
    By miaaa00 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 20th, 2011, 08:28 AM