JDBC Select From problem

Discussion in 'Java' started by Finbar Saunders, Apr 12, 2004.

  1. 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.
    Finbar Saunders, Apr 12, 2004
    #1
    1. Advertising

  2. Finbar Saunders

    Alan Meyer Guest

    "Finbar Saunders" <> wrote in message
    news:c5do92$2qma$...
    > 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".
    Alan Meyer, Apr 12, 2004
    #2
    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. Keith Wansbrough

    Re: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver

    Keith Wansbrough, Aug 16, 2004, in forum: Java
    Replies:
    0
    Views:
    745
    Keith Wansbrough
    Aug 16, 2004
  2. Betty
    Replies:
    1
    Views:
    9,860
    Juha Laiho
    May 21, 2005
  3. Jesus M. Salvo Jr.
    Replies:
    2
    Views:
    4,130
    robert
    Feb 11, 2006
  4. Bruce
    Replies:
    4
    Views:
    750
    Bjorn Abelli
    Mar 25, 2006
  5. Lew
    Replies:
    0
    Views:
    515
Loading...

Share This Page