f



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

Hi,

I am TRYING to learn Jdeveloper 10.1.3 with Oracle 10.

I have a JSP page, with the code below. When I run the page I get the
java.sql.SQLException: Io exception: Got minus one from a read call
error????

What am I doing wrong??
How do you use the insert statement in the code????

Hi, I have an INSERT file.

JDBC.java

package com;

import java.sql.*;



insert.JSP <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page
contentType="text/html;charset=windows-1252"%>

<html> <head> <meta http-equiv="Content-Type" content="text/html;
charset=windows-1252"/> <title>AnsFm</title> </head> <body>

<%@ page language="java" import="java.sql.*" %>

<%out.println("The title was:" + request.getParameter("title") ); %>
<%out.println("The title was:" + request.getParameter("link") ); %>
<%out.println("The title was:" + request.getParameter("descp") );%>
</body> </html>

public class JDBCINS

{

String driver = "oracle.jdbc.OracleDriver";

public JDBCINS() { } public static void main(String args[])

{ blahh .. blahh }

}


I get the error:

00 Internal Server Error

java.sql.SQLException: Io exception: Got minus one from a read call
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:287)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
at
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:430)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:608)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at _Insert._jspService(_Insert.java:58)
[/Insert.jsp]
at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0)
].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
at
oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)

0
Clive
6/20/2006 3:17:28 PM
comp.lang.java.databases 3049 articles. 0 followers. samyaksulabh (16) is leader. Post Follow

4 Replies
2505 Views

Similar Articles

[PageSpeed] 16

"Clive" <cliveswan@yahoo.co.uk> wrote in message
news:1150816648.400981.113690@g10g2000cwb.googlegroups.com...
> Hi,
>
> I am TRYING to learn Jdeveloper 10.1.3 with Oracle 10.
>
> I have a JSP page, with the code below. When I run the page I get the
> java.sql.SQLException: Io exception: Got minus one from a read call
> error????
>
> What am I doing wrong??
> How do you use the insert statement in the code????

Are you sure the insert statement is correct? If you run it directly on the
Oracle database, does it work?

Here is a link on how to perform an insert -
http://jcsnippets.atspace.com/java/database/insert-row-into-database.html .

As far as I can see, the problem you're faced with is in the "{ blahh ..
blahh }" section - the code you did not post.

Best regards,

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks


0
jcsnippets
6/20/2006 9:02:04 PM
Hi,

Progress since then, but still cannot connect to Oracle:
JDEVELOPER 10.1.3 With Oracle 10g express

Cannot see why, I cannot conect to Oracle?????

Thanks

clive

//
error message:
 <%
//Using the request object to extract input values of registration page

String title = request.getParameter("title");
String link = request.getParameter("link");
String descp = request.getParameter("descp");

Connection con = null;
try {
//Load the class file for the driver
Class.forName("oracle.jdbc.driverOracleDriver");
//Establish a connection with the ODBC datasource
con =
DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:XE","sa","");
//The prepared statement to insert values in the table at runtime
PreparedStatement st=con.prepareStatement("insert into rsstb (title,
link, descprition) values (?, ?, ?)");
//The statement to insert appropriate values into the registration
table
st.setString(1, title);
st.setString(2, link);
st.setString(3, descp);
st.executeUpdate();
}
finally {
try {
if (con != null) {
// Close the connection
con.close();
}
}

0
Clive
6/22/2006 10:28:25 PM
"Clive" <cliveswan@yahoo.co.uk> wrote in message
news:1151015305.902494.167820@i40g2000cwc.googlegroups.com...
> Hi,
>
> Progress since then, but still cannot connect to Oracle:
> JDEVELOPER 10.1.3 With Oracle 10g express
>
> Cannot see why, I cannot conect to Oracle?????
>

Hi Clive,

Check your mail - I have replied to your (other) mail with possible
solutions.

AFAIK, it's because of classpath problems, ie the driver cannot be found.

Please try it again with the correct jars/classpath, and if all else fails
please post the errors you are getting here as well. This way, other people
can jump in and help and/or benefit from a possible solution as well.

Best regards,

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks


0
jcsnippets
6/23/2006 3:24:51 PM
Hi,

Still getting error!!!
any advice???

Thanks

clive

The classpath is:C:\oraclexe/app/oracle\product\10.2.0\server\jdbc\lib
files are: ojdbc14.jar and ojdbc14_g.jar

<body>

    <%
   Connection conn = null;
   try
   {
      Class.forName("oracle.jdbc.driver.OracleDriver");

      conn = DriverManager.getConnection(
                "jdbc:oracle:thin:@127.0.0.1:1521:XE",
                "sa",
                "");

      Statement stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery("SELECT * FROM RSSTB");

      //Print start of table and column headers
      out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\"
BORDER=\"1\">");
      out.println("<TR><TH>ID</TH><TH>NAME</TH></TR>");

      //Loop through results of query.
      while(rs.next())
      {
         out.println("<TR>");
         out.println("<TD>" + rs.getString("ID") + "</TD>");
         out.println("<TD>" + rs.getString("Title") + "</TD>");
         out.println("</TR>");
      }

      out.println("</TABLE>");
   }
   catch(SQLException e)
   {
      out.println("SQLException: " + e.getMessage() + "<BR>");
      while((e = e.getNextException()) != null)
         out.println(e.getMessage() + "<BR>");
   }
   catch(ClassNotFoundException e)
   {
      out.println("ClassNotFoundException: " + e.getMessage() +
"<BR>");
   }
   finally
   {
      //Clean up resources, close the connection.
      if(conn != null)
      {
         try
         {
            conn.close();
         }
         catch (Exception ignored) {}
      }
   }
%>

  </body>

The error message is:

java.lang.IllegalAccessError: oracle/jdbc/driver/OracleDriverExtension
	at oracle.jdbc.driver.OracleDriver.<init>(OracleDriver.java:51)
	at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:470)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)
	at _Listtest._jspService(_Listtest.java:47)
	[/Listtest.jsp]
	at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.0.0)
].http.OrionHttpJspPage.service(OrionHttpJspPage.java:60)
	at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416)
	at
oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
	at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
	at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
	at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
	at
oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
	at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
	at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0)
].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
	at java.lang.Thread.run(Thread.java:595)

0
Clive
6/24/2006 3:07:01 PM
Reply: