你用Statement代替PreparedStatement。PreparedStatement是预编译的,要有替换参数,你的程序中没用到参数,用Statement就可以了。
另外建议定义时初始化:
PreparedStatement pins = null;
Connection c = null;
ResultSet r = null;//这个没用上就不用要了。
还有,最好操作完毕后关闭连接。
pins.close();
c.close();