JDBC Select From problem

F

Finbar Saunders

Hi, I'm using the JDBC:ODBC bridge but am having a problem using it with MS
Access.

I want to run the following thru the bridge;
SELECT * FROM Horse WHERE horseName Like 'MINORS UNION'

I can run this query in Access with no probs. I get an SQL.Exception when
running thru the bridge.

I am assuming the problem lies with the keyword UNION being used in the
value.

any help appreciated,
Michael.
 
A

Alan Meyer

Finbar Saunders said:
Hi, I'm using the JDBC:ODBC bridge but am having a problem using it with MS
Access.

I want to run the following thru the bridge;
SELECT * FROM Horse WHERE horseName Like 'MINORS UNION'

I can run this query in Access with no probs. I get an SQL.Exception when
running thru the bridge.

I am assuming the problem lies with the keyword UNION being used in the
value.

You have to check the message associated with the exception, e.g.,

try {
...
}
catch SQLException e {
system.out.println (e.getMessage());
}

It may have nothing to do with the SQL itself, but rather with
the connection, the statement, or something else.

Note, by the way, that "Like 'MINORS UNION'" is identical to
"='MINORS UNION'". Without a '%' in the like clause, there
is no reason to use "like".
 

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,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top