Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners jdbc connectivity through jsp

Have Programming Question? Ask it here!
 
 
 


krishnachaitanya
jdbc connectivity through jsp
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners


my code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>hi to all</title>
</head>
<body>
    Hi this is my page
    <% 
    Connection conn = null;
    String userName = "root";
    String password = "";
    String url = "jdbc:mysql://localhost/interviewer";
    System.out.println(url);
    System.out.println("username="+userName+", password=" +""+password);
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();//it shows error this line
    conn = DriverManager.getConnection (url, userName, password);
    Statement select = conn.createStatement();
    ResultSet result = select.executeQuery ("SELECT username,password FROM login where login_id=212");         

    System.out.println("Got results:");
    while(result.next()) { // process results one row at a time
      String username = result.getString(1);
      String pwd = result.getString(2);

      System.out.println("userid = " +username );
      System.out.println("password= " + pwd);
    }
%>
</body>
</html>

______________________end of the code-----------------------------------------------

i got this error

HTTP Status 500 -

type Exception report

message

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

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /mypage.jsp at line 20

17:     String url = "jdbc:mysql://localhost/interviewer";
18:     System.out.println(url);
19:     System.out.println("username="+userName+", password=" +""+password);
20:     Class.forName ("com.mysql.jdbc.Driver").newInstance ();
21:     conn = DriverManager.getConnection (url, userName, password);
22:     Statement select = conn.createStatement();
23:     ResultSet result = select.executeQuery ("SELECT username,password FROM login where login_id=212");         


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
    org.apache.jsp.mypage_jsp._jspService(mypage_jsp.java:105)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

root cause

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:126)
    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:169)
    org.apache.jsp.mypage_jsp._jspService(mypage_jsp.java:83)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

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

Advertisement
View Answers

Related Tutorials/Questions & Answers:
jdbc connectivity through jsp
jdbc connectivity through jsp  my code: <%@ page language="java... = ""; String url = "jdbc:mysql://localhost/interviewer... org.apache.jasper.JasperException: An exception occurred processing JSP page /mypage.jsp
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
Advertisements
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
JDBC CONNECTIVITY
file in environment variable.   Java Mysql connectivity Other JDBC...JDBC CONNECTIVITY  How do i connect my database to java. I have the connector file and i place it in lib of jdk folder and installed the jdbc driver
JDBC CONNECTIVITY
connectivity Other JDBC Tutorials...JDBC CONNECTIVITY  import java.sql.Connection; import..."); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/abhi
How to create a data base connectivity using sqlserver or Mydql through J2ME - JDBC
How to create a data base connectivity using sqlserver or Mydql through J2ME... connectivity using sqlserver through J2ME. Currently we are working... is billpayment through mobile. in registration i want to fill the all the data
connectivity - JDBC
) org.apache.jsp.gui1_jsp._jspService(gui1_jsp.java:142...(DriverManager.java:171) org.apache.jsp.gui1_jsp._jspService(gui1_jsp.java:70... driver for JDBC and set in the Tomcat/lib folder and if any more problem give full
connectivity - JDBC
connectivity  How can we connect sql server using Java   Hi Friend, By using JDBC drivers, you can connect SQL server with java. Please visit the following link: http://www.roseindia.net/jdbc/jdbc.shtml
jdbc connectivity
jdbc connectivity  import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; public class NewJFramefin extends...=e.getActionCommand(); String check; String str="jdbc:odbc:dsn1
database connectivity - JDBC
connectivity programs with MSacces   Hi Friend, If you havn't create your... and Create the DSN name (e.g emp) 6. Click "Ok" and then try the JSP. For programs,visit the following links: http://www.roseindia.net/jdbc/Jdbc-odbc
JDBC CONNECTIVITY - JDBC
JDBC CONNECTIVITY  String jclass="sun.jdbc.odbc.JdbcOdbcDriver"; Class.forName(jclass); String dsn= "Jdbc:Odbc:Employee"; Connection con... = con.prepareStatement("insert into detail values(?,?,?,?)"); I am a bigner in Jdbc so please tell
JDBC Connectivity - JDBC
JDBC Connectivity  my question is how to connect a Java program with MS-Access database?  Hello Use this code import java.sql.... String filename = "d:/java/mdbTEST.mdb"; String database = "jdbc
jdbc connectivity to mysql tutorial
jdbc connectivity to mysql tutorial  here is complete jdbc connectivity to mysql tutorial for newbies. Person who don't even know how to install mysql and don't know about which driver to use can do with ease
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am...; String url = "jdbc:mysql://localhost:3306/"; String dbName... the following link: http://www.roseindia.net/jdbc/jdbc-mysql
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Eclipse Connectivity - JDBC
Eclipse Connectivity  Hello Friends.. I want to do connectivity... connectivity..and which plugins are required for it. i have try to do connectivity but i got given below error. "Error Occured Error
mysql jdbc connectivity
mysql jdbc connectivity  i want to connect retrieve data from mysql using jdbc
database connectivity in java - JDBC
database connectivity in java  import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; class... con1; con1=DriverManager.getConnection("jdbc:odbc:Mycon
database connectivity - JDBC
."); Connection conn = null; String url = "jdbc:mysql://localhost:3306...(); } } } For more information on JDBC in java visit to : http://www.roseindia.net/jdbc
audio files in jdbc connectivity with ms-access - JDBC
audio files in jdbc connectivity with ms-access  i need to know how to retrieve audio files through jdbc connectivity with ms-access and how to play them through link in browser....  Hi Friend, Try the following code
Jdbc connectivity by type 4 driver
Jdbc connectivity by type 4 driver  I have done a code with database connectivity with driver 4,it copiles,but while running it is showing...=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521","system","123
regarding connectivity program only - JDBC
regarding connectivity program only  can u give me code regarding..., i am sending simple code of connectivity import java.sql.*; public... = "jdbc:mysql://192.168.10.211:3306/"; String db = "amar"; String driver
JDBC-Odbc Connectivity
JDBC-ODBC Connectivity       The code illustrates an example from JDBC-ODBC Connectivity. The code helps you in retrieve the name and size of the column
regarding connectivity program only - JDBC
regarding connectivity program only  can u give me code regarding .. that i had created student data base with his name and subject marks resp ... i use html in front end ...that there r options like 1.name---------- 2.sub1
Java vs Oracle Connectivity - JDBC
) Load and Register the JDBC driver:*********** DriverManager.registerDriver... = DriverManager.getConnection("jdbc:oracle:oci8: @oracle.world", "root", "root"); where... = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:3306:roseindia", "root", "root
JDBC - Java Database Connectivity Tutorial
JDBC - Java Database Connectivity Tutorials  ...; New Features in JDBC 4.0 Java database connectivity (JDBC) is the Java... rows. JDBC Tutorials JDBC (Java Database Connectivity
jsp page connectivity with oracle - SQL
jsp page connectivity with oracle  I am unable to database connectivity jsp with oracle. Please send the code for solving problem. thanks ...= DriverManager.getConnection("jdbc:oracle:oci8: @oracle.world", "root", "root
JSP-Oracle connectivity
JSP-Oracle connectivity  I have created a "dynamic web project" mainly with jsp files in eclipse and now, want to connect with oracle 10g, so how can I proceed for the database connection
connectivity - JSP-Servlet
to connect that datas to Jsp Program.kindly help me
DataBase connectivity in java with Microsoft sql server2000 - JDBC
DataBase connectivity in java with Microsoft sql server2000  How i can achieve database connectivity with Microsoft sql server2000 in my java source code
JDBC Connectivity Code In Java
JDBC Connectivity Code In Java      ... in understanding JDBC Connectivity Code in Java. In this program, the code...;url = "jdbc:mysql://localhost:3306/";   
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
value is inserted into the sql table through jsp-jdbc but not getting stored..."> <title>JSP Page</title> <style type...=DriverManager.getConnection("jdbc:oracle:thin:@Nayna-PC:1521:orcl","scott","tiger
database connectivity using jsp code
database connectivity using jsp code  i have two tables employee...),'bbbb','bbbb'); so this syntax is possible to use in jsp code based on employee id ename and designation are displayed how it is possible in jsp employee
online database connectivity issue from JSP page .
online database connectivity issue from JSP page .  Hi; Everything working fine in localhost , but facing a simple problem in connectivity... = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;"+"databaseName=dorakoina
online database connectivity issue from JSP page .
online database connectivity issue from JSP page .  Hi; Everything working fine in localhost , but facing a simple problem in connectivity... = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;"+"databaseName
online database connectivity issue from JSP page .
online database connectivity issue from JSP page .  Hi; Everything working fine in localhost , but facing a simple problem in connectivity... = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;"+"databaseName=dorakoina
The required JDBC drivers to establish connectivity to my database part of the JDK.
The required JDBC drivers to establish connectivity to my database part of the JDK.  Are all the required JDBC drivers to establish connectivity to my database part of the JDK
Database connectivity with jsp code - JSP-Servlet
Database connectivity with jsp code  I have written a program in java having connectivity with online_exam. Its working properly. Connection has been... is there with jsp code.Its giving the exceptions I have posted u before. I dont know
jsp sql server 2005 connectivity
jsp sql server 2005 connectivity  your jsp mysql tutorial is very help full.Please tell me how to connect jsp with SQL server 2005
JDBC, Java Database Connectivity
tutorials. Java Database Connectivity or JDBC for short is Java bases API... driver as per your application needs. About JDBC Java Database Connectivity... JDBC In this section you will find the list all the best JDBC tutorials we
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying... successful so far. However when i try to connect to sql through a normal java program.... Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql
database through jsp
database through jsp  sir actually i want to retrieve the data from... are there in the database? thanks   Here is an example of jsp which retrieves data from...;% Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db
Java JSP - JDBC
Java JSP  JDBC connectivity in JSP?  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml Hope that it will be helpful for you. Thanks
Jdbc connectivity in java to oracle for retrieving data between two dates
Jdbc connectivity in java to oracle for retrieving data between two dates  Dear Sir, I Need a program in which i want to retrieve the data b/w two dates from the database table. I am using combo box to get the date. Problem
jsp - JDBC
jsp  I have one jsp code.but it is included oracle databse connectivity. I want to change it "sql server 2005" connectivty because I don't know...("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
. 3) code and procedure to establish jdbc connectivity and to store...code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..  Dear sir
code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..
. 3) code and procedure to establish jdbc connectivity and to store...code to validate username password of gmail and procedures to establish jdbc connectivity to store unread mails and retreive it..  Dear sir
 

 

 

DMCA.com