Results 1 to 3 of 3

Thread: I dont' think this is possible but...

  1. #1
    Join Date
    Dec 2004
    Posts
    9

    Default I dont' think this is possible but...

    Hi all, I am connecting to an access database (because I have to) through a JDBC emulator thing we bought. Everything is fine but the original designer of the access db put a f(*&%%^ question mark in a column name, so of course when I try the following...

    insertQuery = new SqlUpdate(dataSource,
    "INSERT INTO TPARTICIPANTREGISTRATION (REGISTERID,PROGRAMID,EVENTID,FIRSTNAME,LASTNAME,C OMPANY,ADDRESS,ADDRESS2,CITY,STATE,ZIP," +
    "OFFICEPHONE,FAX,EMAIL,[$PAID],ENTRYDATE,MAILCODE,SENDEMAIL,TITLE,TPARTICIPANTRE GISTRATION.[PAID?]) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

    It doesn't work because of the question mark in the column name (PAID?), because it thinks that is one of the params. Any body have any ideas, I really would rather not touch the access db because then I'll have to change all their custom reports and forms that reference it. Thanks!

  2. #2
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    I remember the standard JDBC has an 'escape' keyword that allows to declare an escape character like '\'...

    Ah, here it is: http://java.sun.com/developer/online.../jdbc.html#esc

    Not sure your Access JDBC emulator supports it though.
    --Jing Xue

  3. #3
    Join Date
    Aug 2004
    Posts
    1,104

    Default

    Roger,

    If Access supports "quoted identifiers: then you could try surrounding the column name with double quotes like "... \"PAID?\" ..." or "... \"TPARTICIPANTREGISTRATION.[PAID?]\" ..." - that should let you pass the string untouched by the parameter counting logic. You just have to make sure the case of the column name matches what is declared in the database.
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •