Statement stm=conn.createStatement();  //创建语句对象
InetAddress inetaddress=InetAddress.getLocalHost();//返回主机名和ip的InetAddres型对象String s=inetaddress.getHostAddress();             //返回本机ip地址
int por=1111;                                      //端口号设为1111
stm.executeUpdate("update student set state=1 where state=0");
PreparedStatement pstmt1 = conn.prepareStatement("update student set ip=? where ip=0");
pstmt1.setString(1,s);
PreparedStatement pstmt2 = conn.prepareStatement("update student set port=? where port=0");
pstmt2.setInt(1,por);
state能写入数据库,ip,port写不进数据库?下面是我建的表   conn是connection对象
列名     数据类型  值
id       int     000000 
paw      int     000000 
state   int     0
ip      varchar(15)  0
port    int     0