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. Advertisements

  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. Advertisements

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. koluwa

    nested jdbc (select) queries

    koluwa, Feb 25, 2004, in forum: Java
    Replies:
    1
    Views:
    1,072
    Bjorn Abelli
    Feb 25, 2004
  2. Tristan Buckmaster

    xml select on jdbc server

    Tristan Buckmaster, Sep 23, 2004, in forum: Java
    Replies:
    1
    Views:
    384
    Paul Lutus
    Sep 23, 2004
  3. Betty
    Replies:
    1
    Views:
    10,316
    Juha Laiho
    May 21, 2005
  4. Jesus M. Salvo Jr.
    Replies:
    2
    Views:
    4,528
    robert
    Feb 11, 2006
  5. mareluad
    Replies:
    0
    Views:
    2,163
    mareluad
    Feb 20, 2006
  6. Bruce
    Replies:
    4
    Views:
    974
    Bjorn Abelli
    Mar 25, 2006
  7. Sigfried
    Replies:
    8
    Views:
    629
    Sigfried
    Sep 8, 2008
  8. palmiere
    Replies:
    1
    Views:
    697
    Erwin Moller
    Feb 9, 2004
Loading...