JAVA HELP

CM_LK

Active member
  • Oct 3, 2010
    714
    80
    28
    type Exception report

    message

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

    exception

    org.apache.jasper.JasperException: javax.servlet.ServletException: java.sql.SQLException: The url cannot be null
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

    root cause

    javax.servlet.ServletException: java.sql.SQLException: The url cannot be null
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
    org.apache.jsp.jsp.login_jsp._jspService(login_jsp.java:90)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

    root cause

    java.sql.SQLException: The url cannot be null
    java.sql.DriverManager.getConnection(DriverManager.java:554)
    java.sql.DriverManager.getConnection(DriverManager.java:185)
    src.db.DBConnectionclass.<init>(DBConnectionclass.java:26)
    src.user.UserManager.<init>(UserManager.java:22)
    org.apache.jsp.jsp.login_jsp._jspService(login_jsp.java:76)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

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



    මම ODBC හදලා තියන්නේ, කවුරුහරි දනන කෙනෙක් ඉන්නවා නම් HELP 1 දෙන්න
     

    CM_LK

    Active member
  • Oct 3, 2010
    714
    80
    28
    Manna Class File eka

    package src.db;

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;

    /**
    *
    * @author Chamara
    */
    public class DBConnectionclass {
    private Connection connection = null ;
    private Statement statement = null ;

    public DBConnectionclass(){}

    public DBConnectionclass(String dbUrl , String dbUser , String dbPassword) throws ClassNotFoundException,SQLException{
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // JDBC Method
    this.connection = DriverManager.getConnection(dbUrl, dbUser, dbPassword); // JDBC Method
    }
    catch(ClassNotFoundException ex){}
    }
    public Connection getConnection() {
    return this.connection;
    }

    public void closeConnection() throws SQLException {
    try {
    this.connection.close();
    }
    catch (SQLException ex) {
    throw new SQLException("Database connection close error");
    }
    }

    public void closeStatement() throws SQLException {
    try {
    this.statement.close();
    }
    catch (SQLException ex) {
    throw new SQLException("Database connection close error");
    }
    }

    public Statement getStatement() {
    return this.statement;
    }



    }