This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes java.sql.SQLException: Io exception: Got minus one from a read call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: Io exception: Got minus one from a read call " Watch "java.sql.SQLException: Io exception: Got minus one from a read call " New topic
Author

java.sql.SQLException: Io exception: Got minus one from a read call

Abhi Sarkar
Greenhorn

Joined: Jan 06, 2009
Posts: 1
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Jdbc extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con = DriverManager.getConnection(
"jdbcracle:thin:@localhost:8080:abhishek","scott","tiger");
// @machineName:port:SID, userid, password

out.println("<HTML>");
out.println("<HEAD>");
out.println("<TITLE>Test JDBC Connection</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<H1>Connection Established Successfully</H1>");
out.println("</BODY>");
out.println("</HTML>");

} catch (ClassNotFoundException e1) {
out.println("Connection Failed " + e1.toString());
} catch (SQLException e2) {
out.println("Connection Failed " + e2.toString());
} catch (Exception e3) {
out.println("Connection Failed " + e3.toString());
}
}

}
this is my code. My Sid is abhishek. am using oracle 9i.apache tomcat application server.But the problem i am facing is i am getting "Connection Failed java.sql.SQLException: Io exception: Got minus one from a read call "... Please help!!!
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
First thing is to check that your oracle drivers and your database are the same versions.
 
wood burning stoves
 
subject: java.sql.SQLException: Io exception: Got minus one from a read call
 
Similar Threads
ClassNotFoundException error
Connection reset by peer:JVM_recv in socket input stream read
reading data from jsp page to another jsp page using request.getParameter
Problem in connecting MySql with Servlets
can't define a variable