LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 08-27-2005, 02:04 AM   #1
mukund_r
LQ Newbie
 
Registered: Aug 2005
Posts: 1

Rep: Reputation: 0
Getting problem in JDBC


Details of my s/w on my PC
OS: PCQLinux2005(full version), Servers: Apache,Tomcat,database: MySQL,
database name:airforce, user:airforce, pwd:airforce ,
privileges were given to user airforce on db airforce by the command
grant all on *.* to 'airforce'@localhost:8080' identified by 'airforce'
The Problem
The code in CadetBook.jsp is running when the OS is Win2k with Apache Tomcat and database is MS SQL Server but does not run in Linux with Apache Tomcat and MySQL database. I have changed the driver as
"org.gjt.mm.mysql.Driver"
CadetBook.jsp is called from CadetBook.htm consisting of entry fields.
When executing CadetBook.jsp (check below) i am getting the following error.

===========================================================
errorcom.mysql.jdbc.CommunicationsException: Communications link failure due to underlying

exception: ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at

com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1845) at

com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:476) at

com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:947) at

com.mysql.jdbc.Connection.createNewIO(Connection.java:1702) at

com.mysql.jdbc.Connection.(Connection.java:405) at

com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268) at

java.sql.DriverManager.getConnection(DriverManager.java:525) at

java.sql.DriverManager.getConnection(DriverManager.java:171) at

org.apache.jsp.airforce.CadetBook_jsp._jspService(org.apache.jsp.airforce.CadetBook_jsp:60) at

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99) at

javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325) at

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245) at

javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.

java:731) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)

at

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at

java.lang.Thread.run(Thread.java:595) ** END NESTED EXCEPTION **
=========================================
The table i am using
Table CadetBook
================
CREATE TABLE cadetbook (
slno varchar (50) ,
sdate varchar (50) ,
serno varchar (50) ,
tin varchar (50) ,
tout varchar (50) ,
path varchar (50) ,
auth varchar (50)
)
================
The jsp code i am using
CadetBook.jsp
================
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*" %>

<html>

<body>
<%
try {
try {
Class.forName("org.gjt.mm.mysql.Driver");
} catch (Exception ex) {
System.out.println("Error while loading the Driver : " + ex);
}
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:8080/airforce" , "airforce"

, "airforce");
Statement st=con.createStatement();
int i=st.executeUpdate("insert into cadetbook values('" + request.getParameter("slno") + "','" +

request.getParameter("sdate") + "','" + request.getParameter("serno") + "','" +

request.getParameter("tin") + "','" + request.getParameter("tout") + "','" +

request.getParameter("path") + "','" + request.getParameter("auth") + "')");

if (i==1)
out.println("Record Inserted.");
else
out.println("Record not Inserted.");
} catch (Exception e) {out.println("error"+e);}%>
</body>

</html>
================
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
JDBC-ODBC connectivity problem rajivb Programming 3 03-09-2005 10:22 AM
regarding jdbc driver pranith Linux - Newbie 5 01-27-2005 12:11 PM
Jdbc apffal Linux - General 0 10-07-2004 12:37 PM
JDBC PROBLEM (JAVA using JCreator) keikun_naruchan Programming 3 06-04-2004 02:02 AM
jdbc mysql Redhat 7.2 problem johnlee Linux - General 1 04-23-2002 06:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 02:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration