Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Database connectivity problem-Oracle

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Database connectivity problem-Oracle

    Hello techs,

    Could anyone help me out to sort the below exception error.

    Oracle Port: 8080 Tomcat Port : 8088

    HTTP Status 500 -

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: Servlet execution threw an exception

    root cause

    java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
    db.DAO.getConnection(DAO.java:38)
    db.DAOQuery.register(DAOQuery.java:113)
    actions.RegistrationAction.execute(RegistrationAct ion.java:58)
    org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)
    org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)
    org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
    org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.

    The below coding might be helpful to resolve.

    DAO Coding:
    package db;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FileInputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.lang.String;
    import oracle.jdbc.pool.OracleDataSource;
    import java.sql.*;
    import java.util.Properties;
    /**
    *This class used to establish the connection between JdbcDriver and DataBase.
    *DataSourceName will be created through URL.Connection will be
    *created successfully next data will be inserted.Suppose
    *connection can not be created then Exception occured.
    *
    *DriverManager class -- makes a connection with a driver
    */
    public class DAO
    {
    public static Connection con = null;
    public Connection getConnection(String path)
    {
    Properties property;
    try
    {
    property = new Properties();
    File f=new File(path);
    FileInputStream filein=new FileInputStream(f);
    property.load(filein);
    String systemname = property.getProperty("SYSTEMNAME");
    OracleDataSource ods=new OracleDataSource();
    ods.setUser("SYSTEM");
    ods.setPassword("REDHAT");
    ods.setURL("jdbc:oracle:oci:system@"+systemname+":8088/XE");
    con=ods.getConnection();
    }
    catch(SQLException e)
    {
    System.out.println("1");
    e.printStackTrace();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }
    return con;
    }
    public boolean returnConnection(Connection conn)
    {
    boolean status=true;
    try
    {
    con.close();
    }
    catch(Exception e)
    {
    status=false;
    }
    return status;
    }
    }


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Database connectivity problem-Oracle

    Sounds like you're missing oracle.jdbc.pool.OracleDataSource at runtime, place the appropriate jar file in your application server lib folder or include it with your app.

    // Json

  3. The Following User Says Thank You to Json For This Useful Post:

    Entrant (October 10th, 2009)

  4. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Database connectivity problem-Oracle

    Hi Json,,,,,

    Ur knowledge sharing helped me to sort out the problem...

    Thanks buddy!!!!!

  5. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Database connectivity problem-Oracle

    No worries, glad to help.

    // Json

Similar Threads

  1. updating database
    By gurpreetm13 in forum JDBC & Databases
    Replies: 3
    Last Post: October 9th, 2009, 11:43 AM
  2. Oracle to Buy Sun
    By Fendaril in forum The Cafe
    Replies: 2
    Last Post: June 21st, 2009, 10:48 AM
  3. Desktop Database Application
    By TCoomer in forum JDBC & Databases
    Replies: 2
    Last Post: June 4th, 2009, 03:51 PM
  4. Replies: 1
    Last Post: November 12th, 2008, 05:16 PM
  5. Website to study Struts framework
    By kirman in forum Java IDEs
    Replies: 2
    Last Post: October 17th, 2008, 07:26 AM