title: jdbc.BadSqlGrammarException table or view does not exist. Tested query in database, works. But web application errors
body: <blockquote>
    <p><strong>EDIT: FIXED! Look below</strong></p>
  </blockquote>
  
  <p>So I have tested the query in SQL Developer and it works fine. However, in my implementation, the run does not load the data into the list and spits out this error:</p>
  
  <blockquote>
    <p>org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad
        SQL grammar [select columnname,displayname, viewsortorder,capsdisind,window, DIS
        FIELDID , (select  1 from WEB_CUSTDISABLEDFIELDS where custid =? AND  A.DISFIELD
        ID  = WEB_CUSTDISABLEDFIELDS.DISFIELDID) from web_DISABLEDFIELDS  A ]; nested ex
        ception is java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist<br>
            at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.d
        oTranslate(SQLErrorCodeSQLExceptionTranslator.java:220)
                at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslat
        or.translate(AbstractFallbackSQLExceptionTranslator.java:72)
                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:
        607)
                at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:64
        1)
                at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:67
        0)
                at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:67
        8)
                at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:71
        0)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdap
        ter.java:421)
                at flex.messaging.services.RemotingService.serviceMessage(RemotingServic
        e.java:183)
                at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java
        :1503)
                at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndp
        oint.java:884)
                at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBroker
        Filter.java:121)
                at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:15
        8)
                at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:
        44)
                at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFi
        lter.java:67)
                at flex.messaging.endpoints.amf.SerializationFilter.invoke(Serialization
        Filter.java:146)
                at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.ja
        va:278)
                at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java
        :322)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
        icationFilterChain.java:304)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
        ilterChain.java:210)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
        alve.java:224)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
        alve.java:175)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
        torBase.java:472)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
        ava:164)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
        ava:100)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
        929)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
        ve.java:118)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
        a:405)
                at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcesso
        r.java:316)
                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(
        AbstractProtocol.java:515)
                at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoin
        t.java:1544)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                at java.lang.Thread.run(Unknown Source)
        Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.ja
        va:91)
                at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:1
        12)
                at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
        :173)
                at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
                at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
                at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
                at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.
        java:194)
                at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPrepare
        dStatement.java:785)
                at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPrepa
        redStatement.java:860)
                at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
        nt.java:1186)
                at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep
        aredStatement.java:3381)
                at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
        dStatement.java:3425)
                at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(Oracle
        PreparedStatementWrapper.java:1490)
                at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(Jd
        bcTemplate.java:648)
                at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:
        591)
                ... 39 more</p>
  </blockquote>
  
  <p>I've searched multiple problems with this error but none of them seem to address the same issue as mines. I am using Oracle SQL.</p>
  
  <p>Maybe someone has ran into this problem before? Any help is appreciated. Thanks!</p>
  
  <p><strong>FIXED THE PROBLEM</strong></p>
  
  <p>The issue was the tables. They just needed permissions in the database to be accessed.</p>
  
  <p>What I did was this:</p>
  
  <pre><code>grant all on sa.table to public
  /
  create public synonym table for sa.table
  /
  grant all on sa.table2 to public
  /
  create public synonym table2 for sa.table2
  /
  </code></pre>