Jun 3rd, 2005, 09:55 AM
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!
Jun 3rd, 2005, 01:09 PM
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.
Jun 4th, 2005, 09:32 AM
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.