0

I'm having a problem getting a java ResultSet on an Oracle XE 11g release 2 database. I am using the ojdbc6_g.jar driver from Oracle to set up the JDBC connection. I get the following error: ORA-00904: "PARSEBOOL": invalid identifier

This is my Java code:

st = s.getConnection().createStatement();
rs = st.executeQuery("SELECT ID, METHODNAME, BEAN, PARSEBOOL, HASHID, ALIAS, WEBTAB FROM METHODS");

I am pretty sure this is correct because it all worked while testing on HSQLDB.

The table METHODS is defined as follows in SQLDeveloper:

CREATE TABLE "DFOLSTAT"."METHODS"
  (
    "ID"         NUMBER(*,0) NOT NULL ENABLE,
    "METHODNAME" VARCHAR2(100 BYTE),
    "BEAN"       VARCHAR2(100 BYTE),
    "HASHID"     VARCHAR2(2 BYTE),
    "ALIAS"      VARCHAR2(100 BYTE),
    "WEBTAB"     VARCHAR2(100 BYTE),
    "PARSEBOOL"  CHAR(1 BYTE),
    CONSTRAINT "METHODS_PK" PRIMARY KEY ("ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE,
    CONSTRAINT "METHODS_HASHID" UNIQUE ("HASHID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE         DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE
  )

I read about possible errors due to case sensitive column names but when performing a query in SQLDeveloper or the command line, everything works fine. What am I doing wrong?

Thanks in advance,

Siebe

4

3 回答 3

0

Maybe you have a clash with a function name. Try surrounding the column name with double quotes, just as you have in the CREATE TABLE statement.

于 2012-07-28T10:02:32.997 回答
0

您使用的驱动程序似乎不合适...尝试使用 ojdbc14.jar 它很容易在 oracle 的网站上提供.. 其余代码还可以

于 2012-07-28T10:17:44.633 回答
0

您可以尝试如下调用您的表吗

        rs = st.executeQuery("SELECT METHODS.ID, METHODS.METHODNAME, 
METHODS.BEAN, METHODS.PARSEBOOL, METHODS.HASHID, METHODS.ALIAS, 
    METHODS.WEBTAB FROM DFOLSTAT.METHODS");

或试试这个

    rs = st.executeQuery("SELECT ID, METHODNAME, BEAN, \"PARSEBOOL\", HASHID, 
ALIAS, WEBTAB FROM METHODS");
于 2012-07-29T05:55:17.227 回答