executeQuery() - How many SQL statements allowed?

P

PHIL MCDONALD

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
 
J

Joan

Blank
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
 
M

Malte

Joan said:
Don't know about Access but for real RDBMS systems there should be no
such limitation. I routinely use executeQuery() for complex statements.
 
R

Roedy Green

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
 
A

Alan Krueger

PHIL said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top