求java.sql.PreparedStatement源代码 
想知道
setObject(int parameterIndex, Object x) 方法具体怎么写的?

解决方案 »

  1.   

    http://javaalmanac.com/egs/java.sql/InsertObjectOraclePreparedStatement.html
    Inserting an OBJECT Value into an Oracle Table Using a Prepared Statement
    This example inserts Oracle OBJECTs into an Oracle table using a prepared statement. The example uses the OBJECT types and table created in e296 Creating an OBJECT Type in an Oracle Database. 
        try {
            // Create an oracle.sql.STRUCT object to hold the values for object2
            Object[] object2Values = new Object[]{"str", new BigDecimal(123)};
            oracle.sql.StructDescriptor structDesc =
                oracle.sql.StructDescriptor.createDescriptor("OBJECT2", connection);
            oracle.sql.STRUCT object2 =
                new oracle.sql.STRUCT(structDesc, connection, object2Values);
        
            // Create an oracle.sql.STRUCT object to hold the values for object1
            Object[] object1Values = new Object[]{"str", object2};
            structDesc = oracle.sql.StructDescriptor.createDescriptor("OBJECT1", connection);
            oracle.sql.STRUCT object1 =
                new oracle.sql.STRUCT(structDesc, connection, object1Values);
        
            // Create a prepared statement for insertion into object1_table
            PreparedStatement ps =
                connection.prepareStatement("INSERT INTO object1_table VALUES(?,?)");
        
            // Set the values to insert
            ps.setInt(1, 123);
            ps.setObject(2, object1);
        
            // Insert the new row
            ps.execute();
        } catch (SQLException e) {
        }
      

  2.   

    感觉应该是各个数据库的厂商所实现的都不一样吧,不过应该是按照sun公司所提供的规范来实现的,
      

  3.   

    java.sql.PreparedStatement is just an interface and different jdbc driver has different implementation.
      

  4.   

    你的jdk里面没有src的目录吗?