probably u dont have the driver set right to your datasource .make sure ur
using the correct data source name .Probably u got to find that out from the
DBA who created the database.
A NullPointer exception occurs when u are trying to call a function on a
NULL Object ...for example for ex ..if OBject a =null; u cant say
a.toString(); make sure the object u are calling some function is not null
...
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Suhail Beig
Sent: Friday, March 17, 2000 12:31 AM
To: [EMAIL PROTECTED]
Subject: Re: problem during accessing database...
Hi Ajai
I too got that kind of error . But then I found that i
was missing the java lib path in the CLASSPATH
add tools.jar to CLASSPATH and it should solve the
problem
Cheers
Suhail
--- J Krishna Rao <[EMAIL PROTECTED]> wrote:
> Hi Ajai,
> I have changed the code as per your advice,But
> currently i am able to getting
> some error messages in Apache server's log as
> below:-
> Apache JServ 1.1
> Jserv log file:-
> [17/03/2000 10:34:09:515
> GMT+05:30]
> java.lang.NullPointerException
> at Hello.doGet(Compiled Code)
> at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
> at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
> at
>
org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
> at
>
org.apache.jserv.JServConnection.run(JServConnection.java:188)
> at java.lang.Thread.run(Thread.java:479)
>
> In Apache group --
> access log as follow:-
> [17/Mar/2000:10:34:09 +0530] "GET
> /servlet/Hello HTTP/1.0" 200
> 136
> error log as follow:-
> problems connecting to
>
> My feeling is that some libary is missing in Apache
> Server setting ,so can you
> tell me which is the libary i have include in the
> Apache server and where i
> have to add ,what is libary name for jodb-odbc
> bridge driver.
>
> waiting quick response from you
>
> Thanks
> Krishna
>
>
> Ajai Peddapanga wrote:
>
> > use try catch while connecting and retrieving data
> ....u will know where
> > exactly the problem is ...for example ...
> > try {
> >
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> > } catch (Exception e) {
> > System.out.println("Failed to load
> JDBC/ODBC driver.");
> > return;
> > }
> >
> > Statement stmt = null;
> > Connection con=null;
> > try {
> > Connection con =
> >
>
DriverManager.getConnection("jdbc:odbc:local123","scott","tiger");
> > stmt = con.createStatement();
> > } catch (Exception e) {
> > System.err.println("problems
> connecting to ");
> > }
> >
> > try {
> > Statement stmt = con.createStatement();
> >
> > //Query
> > ResultSet rset =
> stmt.executeQuery("select EMPNAME from EMP1");
> >
> > // Iterate through the result and print
> the employee names
> > while(rset.next())
> > out.println(rset.getString("EMPNAME"));
> > con.close();
> > }
> > catch (Exception e) {
> > e.printStackTrace();
> > }
> >
>
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html