| 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(
"jdbc racle: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.
|
 |
 |
|
|
subject: java.sql.SQLException: Io exception: Got minus one from a read call
|
|
|