日期:2014-05-17  浏览次数:21432 次

无法从套接字中读取更多数据
操作数据库的语句如下:
Java code

    public void insert(){
        init();
        String name = db.getName();
        String password = db.getPassword();
        String creator = db.getCreator();
        String description = db.getDescription();
        
        Connection conn = null;
        PreparedStatement stmt = null;
        
        try{
            conn = dataSource.getConnection();
            stmt = conn.prepareStatement("INSERT INTO DATABASES(DBNAME,DBPASSWORD,DBCREATOR,DBDESCRIPTION) VALUES(?,?,?,?)");
            stmt.setString(1, name);
            stmt.setString(2, password);
            stmt.setString(3, creator);
            stmt.setString(4, description);
        }catch(SQLException e){
            e.printStackTrace();
        }
        finally{
            if(stmt != null){
                try{
                    stmt.close();
                }catch(SQLException e){
                    e.printStackTrace();
                }
            }
            if(conn != null){
                try{
                    conn.close();
                }catch(SQLException e){
                    e.printStackTrace();
                }
            }
        }
        
    }




tomcat报错:

java.sql.SQLException: 无法从套接字读取更多的数据 
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) 
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) 
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208) 
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1118) 
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070) 
at oracle.jdbc.driver.T4C8TTIpro.receive(T4C8TTIpro.java:131) 
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:867) 
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268) 
at oracle.jdbc.driver.PhysicalConnection. <init>(PhysicalConnection.java:414) 
at oracle.jdbc.driver.T4CConnection. <init>(T4CConnection.java:165) 
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) 
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) 
at java.sql.DriverManager.getConnection(Unknown Source) 
at java.sql.DriverManager.getConnection(Unknown Source) 
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:281) 
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:269) 
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:253) 
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:234) 
at thesis.tdms.createDB.Test.insert(Test.java:32) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 
at org.apache.el.parser.AstValue.invoke(AstValue.java:131) 
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) 
at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)