File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Error while executing query through JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error while executing query through JDBC" Watch "Error while executing query through JDBC" New topic
Author

Error while executing query through JDBC

Neha Deshmukh
Ranch Hand

Joined: Apr 04, 2007
Posts: 30
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)
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2500
    
    8

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

OCUP UML fundamental and ITIL foundation
youtube channel
Neha Deshmukh
Ranch Hand

Joined: Apr 04, 2007
Posts: 30
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

Joined: Dec 20, 2006
Posts: 2500
    
    8

I'm puzzled. I don't see obvious reasons for the error.

Does userinfo belong to a different schema than userlog?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while executing query through JDBC