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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

JDBC return null when called from a servlet

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
i have a class file that does all the jdbc stuff and return the values from the database to the servlet..
but the problem is when i call the class from the servlet , the resultset is null
but when i call the same class from other class' main: the values are returning jsut fine..
i even stuffed all the functions in the servlet class but still no solution
the oracle is running on default 8080 port and tomcat is running on 8081.
here is the servlet with everything in it

can any one help its important for me.
i am stuck on it....
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator


oracle is running on default 8080


That's not the default port for Oracle.

Why are you using the JDBC-ODBC bridge to connect to Oracle? Would it not be easier and better to use the thin driver?

When you say "the resutls set is null" do you mean it is empty or are you getting a NullPointerException?

One other thing - you should close connections after you've finished with them otherwsie you waste database resources.
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
i am getting null pointer exception so the catch is running ..
my oracle is running on 8080 because it clashed with Tomcat so i changed the port for tomcat from 8080 to 8081..
i will worry about resources after its running ..
can you explain the thin drivers..
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
*WHERE* do you get a NullPointerException?
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
when i am calling the rs.next() function...
on line 26 of the code
 
Marshal
Posts: 7402
1423
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Make rset a local variable of View(String qry) method.
 
ankur tyagi
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
still not working man!!!
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

ankur tyagi wrote:still not working man!!!



Please calm down.
It's not our job to fix your code.
Be grateful that people are trying to help you for free.

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Duplicate of:
https://coderanch.com/t/493572/Servlets/java/Null-Pointer-Exception

I've also noticed that you've already asked this in another forum.
I answered it there.
If you have further questions, please continue in the original thread.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic