Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Error while executing query through JDBC

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am developing one project in which I need to connect to Oracle 10g thr JDBC.
And then querying the database through java code.
My java code for executing select query is:


but I am getting following error.
PS: When I tried to fire this query in database directly its giving me proper reslut.

Can anybody please help me to solve this problem.

java.sql.SQLException: ORA-00942: table or view does not exist

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:
790)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1037)
at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.jav
a:830)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1132)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
1272)
at jsp_servlet._jobportal.__saveuser._jspService(__saveuser.java:275)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3244)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2010)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:1916)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
 
Bartender
Posts: 2658
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Neha,

Can you check a few things:

- do you connect to the same database with 'JDBC' and with 'database directly'?
- do you use the same user in both situations?
- can you show us the exact query you used in 'database directly'?
- can you output the value of strQuery , and show it to us?
- can you run this query from your code and see if that gives the same error (without the where clause ): "select * from userinfo"

Regards, Jan
 
Neha Deshmukh
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Jan,

Here are answers:

do you connect to the same database with 'JDBC' and with 'database directly'?

Yes

do you use the same user in both situations?
Yes
- can you show us the exact query you used in 'database directly'?
select * from userinfo where email='nehad@gmail.com'
- can you output the value of strQuery , and show it to us?
select * from userinfo where email='nehad@gmail.com'
- can you run this query from your code and see if that gives the same error (without the where clause ): "select * from userinfo"
I tried with select * from userinfo but same error

PS: I wrote another select query for same application but in other java file for same database as follows. This code is working fine.
 
Jan Cumps
Bartender
Posts: 2658
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm puzzled. I don't see obvious reasons for the error.

Does userinfo belong to a different schema than userlog?
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic