使用jdbc向sqlserver2000中插入数据,长字符串出问题????

lxplxp 2006-08-16 10:50:23
使用jdbc向sqlserver2000中插入数据,数据表字段的数据类型是varchar(8000),当字符串的长度达到大概1000左右时,无法将数据表写入数据库,同时也没有任何异常被扑捉到,很是奇怪??
try{
DriverManager.registerDriver(myDriver);
conn = DriverManager.getConnection(
"jdbc:sqlserver:***", "sa",
"***");


SQL = "insert into IQPCDetail Values(?,?,?,?,?,?,?,?,?,?,?)";
stm = conn.prepareStatement(SQL);

stm.setString(1, PieceNo);

stm.setString(2, titleDescript);

stm.setString(3, tilteVideo);

stm.setString(4, author);

stm.setString(5, authorUnit);

stm.setString(6, authorTitle);

stm.setString(7, authorIntro);

stm.setString(8, relativePath);

stm.setString(9, fileObject);

stm.setString(10, fileList);

stm.setString(11, createTime);

stm.execute();

} catch (Exception e) {

System.out.print(e.toString());
}
...全文
298 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxplxp 2006-08-16
  • 打赏
  • 举报
回复
没有特殊符号,仔细看过了
上海老猫 2006-08-16
  • 打赏
  • 举报
回复
会不会是长度到1000的时间有什么单引号或特殊符号?
libiao_0524 2006-08-16
  • 打赏
  • 举报
回复
varchar好像是4000吧~
OnlyFor_love 2006-08-16
  • 打赏
  • 举报
回复
把字段类型换成text就没有问题了
tom2005 2006-08-16
  • 打赏
  • 举报
回复
没有问题,可以插入

确定是长度是多少,varchar最长8000字节
lxplxp 2006-08-16
  • 打赏
  • 举报
回复
没有
lcllcl987 2006-08-16
  • 打赏
  • 举报
回复
varchar最大长度不可能达到8000把?
不知道sql server有clob类型没有
lxplxp 2006-08-16
  • 打赏
  • 举报
回复
有没有人遇到过呀??

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧