executeQuery() - How many SQL statements allowed?

Discussion in 'Java' started by PHIL MCDONALD, Sep 30, 2005.

  1. BlankI'm using JDBC to connect to Microsoft Access, and am wishing to query my Access database using statement.executeQuery().

    Problem: executeQuery() seems to not work for SQL statements of more than one condition. For example, if I use 2 or more 'AND' statements, I don't get valid results.

    Question: What am I doing wrong? Can only the simplest, single-statement SQL queries be submitted to the executeQuery() method? Thanks for your input
    PHIL MCDONALD, Sep 30, 2005
    #1
    1. Advertising

  2. PHIL MCDONALD

    Joan Guest

    Blank
    "PHIL MCDONALD" <> wrote in message
    news:...
    I'm using JDBC to connect to Microsoft Access, and am wishing to
    query my Access database using statement.executeQuery().

    Problem: executeQuery() seems to not work for SQL statements of
    more than one condition. For example, if I use 2 or more 'AND'
    statements, I don't get valid results.

    Question: What am I doing wrong?

    you need to show us what you are doing before we can tell
    you what is wrong with it

    Can only the simplest, single-statement SQL queries be submitted
    to the executeQuery() method? Thanks for your input
    Joan, Oct 1, 2005
    #2
    1. Advertising

  3. PHIL MCDONALD

    Malte Guest

    Joan wrote:
    > Blank

    Don't know about Access but for real RDBMS systems there should be no
    such limitation. I routinely use executeQuery() for complex statements.
    Malte, Oct 1, 2005
    #3
  4. PHIL MCDONALD

    Roedy Green Guest

    On Sat, 01 Oct 2005 10:44:37 +0200, Malte
    <> wrote or quoted :

    >Don't know about Access but for real RDBMS systems


    I often refer to Access as a toy database. I think its niche is a
    single user prototyping tool or personal query manager. You might find
    it easier to port your data to one of the true free databases such as
    MySQL, PostGre SQL, HSQLb if only because others are more familiar
    with their quirks.

    for your choices see:
    http://mindprod.com/jgloss/sqlvendors.html


    this essay compares the virtues of MySQL and PostGre SQL
    http://mindprod.com/jgloss/postgresql.html
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Oct 1, 2005
    #4
  5. PHIL MCDONALD

    Alan Krueger Guest

    PHIL MCDONALD wrote:
    > I'm using JDBC to connect to Microsoft Access, and am wishing to query
    > my Access database using statement.executeQuery().
    >
    > Problem: executeQuery() seems to not work for SQL statements of more
    > than one condition. For example, if I use 2 or more 'AND' statements, I
    > don't get valid results.
    >
    > Question: What am I doing wrong? Can only the simplest, single-statement
    > SQL queries be submitted to the executeQuery() method? Thanks for your input


    You don't specify which results you conclude are invalid. I believe
    that when you execute multiple queries, you'll get multiple result sets
    back. As I understand it, the ResultSet returned by executeQuery will
    be the result of the first query. You'll have to call getMoreResults
    and getResultSet to retrieve the other result sets.
    Alan Krueger, Oct 2, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Zanella
    Replies:
    8
    Views:
    1,170
    mfmehdi
    Oct 20, 2006
  2. Harry George
    Replies:
    6
    Views:
    363
    Bart Nessux
    Feb 23, 2004
  3. Event Horizon

    Mysql executeQuery...

    Event Horizon, Jul 2, 2007, in forum: Java
    Replies:
    6
    Views:
    483
    HightowerC
    Jul 2, 2007
  4. Vince
    Replies:
    12
    Views:
    738
    Martin Gregorie
    Jan 21, 2008
  5. Iñaki Baz Castillo
    Replies:
    13
    Views:
    481
    Iñaki Baz Castillo
    May 1, 2011
Loading...

Share This Page