How To Escape Column Names in HSQLDB RDBMS
By Angsuman Chakraborty, Gaea News NetworkSaturday, May 26, 2007
Sometimes you need to have database column names with space or other non-standard characters. The standard procedure is to escape them with backtick (`) character. HSQLDB doesn’t accept either backtick or single quote as escape character. Instead you have to use escaped double quotes as shown in the example below:
st.execute("CREATE TABLE sheet (tg_meta_id int identity primary key, tg_meta_batch int, SKU varchar(255), \"Data Source\" varchar(255), \"e-Biz Manager\" varchar(255))");
Actually it accepts double quotes but as it is embedded within a String enclosed in double quotes, you have to escape the double quotes.
Filed under: Database, HSQLDB, Headline News, How To, J2EE, Java Software, Open Source Software, Programming, RDBMS, Tech Note
Discussion
October 18, 2007: 3:28 am
My HSQLDB JUnit tests broke when I introduced a ‘date’ field in my database schema. Thanks a lot for the tip. |
YOUR VIEW POINT
padmaja