This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 106210 - Lowercase in table name causes a missing table error
Summary: Lowercase in table name causes a missing table error
Status: RESOLVED DUPLICATE of bug 102621
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P3 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-09 21:27 UTC by pegase
Modified: 2007-06-11 12:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pegase 2007-06-09 21:27:43 UTC
SELECT * FROM FicheReference
Generates the following error message: 
Error code -1, SQL state 42X05: Table/View 'FICHEREFERENCE' does not exist.
Line 1, column 1

SELECT * FROM "FicheReference"
Works fine in the "SQL Command window"
Executed successfully in 0 s.
Line 1, column 1

The real table name is "FicheReference". If I create a "new project" - General -
"Java Desktop Application" - "Database Application" - select a database and a
table with lowercase characters in it, I get an error message when I try running
it .

[TopLink Info]: 2007.06.09 04:21:14.874--ServerSession(26867996)--TopLink,
version: Oracle TopLink Essentials - 9.1 (Build b36-rc)
[TopLink Info]: 2007.06.09
04:21:15.186--ServerSession(26867996)--file:/C:/Users/Pierre/Documents/NetBeansProjects/LicefDBTest1/build/classes/-LicefPU
login successful
[TopLink Warning]: 2007.06.09 04:21:15.264--UnitOfWork(28591825)--Exception
[TOPLINK-4002] (Oracle TopLink Essentials - 9.1 (Build b36-rc)):
oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View
'FICHEREFERENCE' does not exist.Error Code: -1
Call:SELECT noFicheRef, noRef, createur, etat, dateCreation FROM FicheReference
Query:ReportQuery(licefdbtest1.FicheReference)
9-Jun-2007 4:21:15 PM application.Application$1 run
SEVERE: Application failed to launch
Local Exception Stack: 
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 9.1 (Build b36-rc)):
oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Table/View
'FICHEREFERENCE' does not exist.Error Code: -1
Call:SELECT noFicheRef, noRef, createur, etat, dateCreation FROM FicheReference
Query:ReportQuery(licefdbtest1.FicheReference)
        at
oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:303)
        at
oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:551)
        at
oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:437)
        at
oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession.java:465)
        at
oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:213)
        at
oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:199)
        at
oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:270)
        at
oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:600)
        at
oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2207)
        at
oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:2173)
        at
oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:774)
        at
oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
        at
oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:677)
        at
oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:731)
        at
oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2219)
        at
oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
        at
oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
        at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:346)
        at
oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:453)
        at licefdbtest1.LicefDBTest1Frame.initComponents(LicefDBTest1Frame.java:211)
        at licefdbtest1.LicefDBTest1Frame.<init>(LicefDBTest1Frame.java:36)
        at licefdbtest1.LicefDBTest1App.startup(LicefDBTest1App.java:20)
        at application.Application$1.run(Application.java:165)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.sql.SQLSyntaxErrorException: Table/View 'FICHEREFERENCE' does
not exist.
        at
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
        at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
        at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
        at
oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1147)
        at
oracle.toplink.essentials.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:597)
        at
oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:470)
        ... 29 more
Caused by: org.apache.derby.client.am.SqlException: Table/View 'FICHEREFERENCE'
does not exist.
        at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
        at
org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
        at
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
        at
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown
Source)
        at
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
        at
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
        at
org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
        at
org.apache.derby.client.am.PreparedStatement.readPrepareDescribeInputOutput(Unknown
Source)
        at
org.apache.derby.client.am.PreparedStatement.flowPrepareDescribeInputOutput(Unknown
Source)
        at org.apache.derby.client.am.PreparedStatement.prepare(Unknown Source)
        at org.apache.derby.client.am.Connection.prepareStatementX(Unknown Source)
        ... 33 more
BUILD SUCCESSFUL (total time: 3 seconds)
Comment 1 David Vancouvering 2007-06-11 04:28:41 UTC
I think this is another example of the confusion caused by quoting identifier
names.  

The ANSI standard specifies that non-quoted identifiers should be converted to
upper case.

You (or NetBeans) probably created the table using quotes around FicheReference,
e.g. CREATE TABLE "FicheReference".

Then when you specify the table name the query either in the SQL Editor without
quotes, you get the error you mention because the database converts non-quoted
identifiers into upper case (as per the standard).  

I am not sure how you force toplink to use a quoted identifier, but that would
probably solve your problem.  Alternately, figure out how you created your
tables and make sure they're not quoted.

I have yet to take a careful look at this, but I *think* that if you use the NB
wizard to create a table, it quotes the identifiers (something we have logged a
bug about), so you might want to create the table yourself using a SQL file and
run it in the SQL Editor.
Comment 2 Andrei Badea 2007-06-11 12:54:02 UTC

*** This issue has been marked as a duplicate of 102621 ***