Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > executeQuery() - How many SQL statements allowed?

Reply
Thread Tools

executeQuery() - How many SQL statements allowed?

 
 
PHIL MCDONALD
Guest
Posts: n/a
 
      09-30-2005
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


 
Reply With Quote
 
 
 
 
Joan
Guest
Posts: n/a
 
      10-01-2005
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

 
Reply With Quote
 
 
 
 
Malte
Guest
Posts: n/a
 
      10-01-2005
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.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      10-01-2005
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.
 
Reply With Quote
 
Alan Krueger
Guest
Posts: n/a
 
      10-02-2005
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if statements and case statements questions John Crichton Ruby 6 07-12-2010 06:17 PM
Prepare Statements VS Statements Vince Java 12 01-21-2008 01:18 PM
component statements within architecture statements Neil Zanella VHDL 8 10-20-2006 09:05 AM
send batch of sql statements to sql server JT ASP General 1 09-27-2005 10:07 PM
if statements with or w/o else statements Harry George Python 6 02-23-2004 06:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57