Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2005, 12:00 AM
Registered User
 
Join Date: Apr 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to swaminathanb
Default ClassNotFoundException

hi

Can anyone help me out in reaching the solution for ClassNotFoundException. Im using J2SDK1.4 and the applcation server/Servlet engine is J2EESDK1.3.1 and the database is Oracle 9i.
Im working environment is Windows2000.

The exception is:

Database Driver not found
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
java.lang.NullPointerException
Error Inserting the Data into the Table
Error insertting the data

The Servlet Code is

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.sql.*;
import java.sql.*;

public class LoginSAPOnline extends HttpServlet

{
        Connection dbcon;

    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException

    {

        // Establishing Connection with database
        try
        {
                        Class.forName("oracle.jdbc.driver.OracleDriver");
                        dbcon=DriverManager.getConnection("jdbc:oracle:thi n:@bbsu-2:1521:keonline","system","knowledge");
            System.out.println("Connection Established");
        }

        catch(ClassNotFoundException e)
        {
            System.out.println("Database Driver not found");
            System.out.println(e.toString());
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
        }

        res.setContentType("text/html");
        PrintWriter out=res.getWriter();
        String username=req.getParameter("username");
        String password=req.getParameter("password");
                String previledge=req.getParameter("previledge");

        int rows=0;
        try

        {
                        PreparedStatement s=dbcon.prepareStatement("insert into login_info(username,password,previledge) values (?,?,?)");
            s.setString(1,username);
            s.setString(2,password);
            s.setString(3,previledge);
            rows=s.executeUpdate();
        }
        catch(Exception e)
        {
            System.out.println(e.toString());
        }
        if(rows==0)
        {
            System.out.println("Error Inserting the Data into the Table");
            System.out.println("Error insertting the data");
        }
        else
        {
            System.out.println("The values have been inserted into the table successfully");

        }

    }

}

I have also downloaded ojdbc14.jar and i've pasted it in
J2SDK1.4.2_04\jre\lib, this is my JDK path..

i've also set the path and Classpath

Path : E:\oracle\B11\817\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\sapdb\programs\bin;C :\sapdb\programs\pgm;%SystemRoot%\system32;%System Root%;%SystemRoot%\System32\Wbem;c:\j2sdk1.4.2_04\ bin;c:\j2sdkee1.3.1\bin;j2sdk1.4.2_04\jre\lib


Classpath:C:\j2sdk1.4.2_04\lib;c:\j2sdkee1.3.1\lib \j2ee.jar

Pls tell me where i'm going wrong..







B.Swaminathan
Mobile:+91 9886510453
 
Old April 13th, 2005, 06:08 AM
Registered User
 
Join Date: Apr 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to anandp
Default

regarding your problem what i think is that you should register your database first and try again,hope you will not get any probs.
bye

Anand Pritam
Software engineer
(bangalore)
 
Old April 13th, 2005, 09:16 PM
Authorized User
 
Join Date: Nov 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

for detail:please refer to offical documentation

http://www.oracle.com/technology/tec...tdocs/faq.html

and follow the step getting started in http://www.oracle.com/technology/tec...pdf/a96654.pdf
 
Old April 13th, 2005, 11:08 PM
Authorized User
 
Join Date: Apr 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

HI
do you have declared your databse here?
E:\j2sdkee1.3.1\configresource.properties

DR POMPEII, THE PLACE OF THE OBLIVION OF GOD





Similar Threads
Thread Thread Starter Forum Replies Last Post
ClassNotFoundException munnadee Apache Tomcat 1 July 13th, 2007 03:24 PM
java.lang.ClassNotFoundException:!!!frpls help jiffin J2EE 0 December 10th, 2004 01:17 AM
Jdbc connection to oracle ClassNotFoundException jeffreak Java Databases 1 August 5th, 2004 12:37 AM
ClassNotFoundException - CLASSPATH problem? pmckeever JSP Basics 0 December 4th, 2003 10:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.