insert语句报错

来源:百度知道 编辑:UC知道 时间:2024/07/07 15:01:27
while ((str = br.readLine()) != null) {
String[] names = str.split("\\|");
String col1=names[0];
String col2=names[1];
String col3=names[2];
String col4=names[3];
String col5=names[4];
String sqlinsert = "insert into readfile values (?,?,?,?,?)";
ps=connection.prepareStatement(sqlinsert);

ps.setString(1,col1);
ps.setString(2,col2);
ps.setString(3,col3);
ps.setString(4,col4);
ps.setString(5,col5);
ps.executeQuery(sqlinsert);

} 执行报ORA-03115错误 ,大家看应该怎样写insert呢,我的意思是insert col1,col2,col3,col4,col5几个变量的值
java.sql.SQLException: ORA-03115: 不支持的网络数据类型或表示法

我读的是一个文本,内容是两行数据 aaa|bbb|ccccc|ffff|dddgfg
1|2222|3333333|dfgg|2dgh 呵呵,现在好了我按下面的写就可以了
while ((str = br.readLine()) != null) {
String[] names = str.split("\\|");
String col1=names[0];
String co


String[] names = str.split("\\|");
改成
String[] names = str.split('|');
这样的格式才是对的,只要改成这样,就可以了……你再调试一下,你取值是不是对的!!

没有贴出错误,我猜测:
1.names 的长度不是5
2.readfile 表的列数不是5,

请检查这2项,
如果还有问题,把错误贴出来。

从你补充的错误来看,是数据库的类型的长度短了。

你执行的是插入操作, 为什么要用executeQuery呢? 应该是executeUpdate

String[] names = str.split("\\|"); 我觉得应该是
String[] names = str.split("|");