【发布时间】:2012-06-26 06:05:11
【问题描述】:
这是我试图存储在数据库中的文件。我想存储标题和 cmets。我确实得到了它,但它只存储第一行。 请帮忙,对数据库不太好。
title : The Descent Part 2 comment : badbaz83 : No it wasn't as good as the first one, but a hell of a lot better than I first feared. Worth a watch, but don't expect it to stand up to the first film.
title : Supernatural comment : MissAyla : I loved this episode. :) I'm thoroughly enjoying the new style, just like the original episodes.
title : Soccer Mom comment : chantellel93 : it's only 10 min so if u smoke 1 its worth the laugh 2/5. xx
【问题讨论】:
-
它是否遍历所有行?有没有抛出异常?
-
解析纯 txt 文件会是*ss 的痛苦...你考虑过使用 XML 文件吗?
-
你在哪里设置
id?如果id是主键,它必须是唯一的。如果你想自动增加id你不需要在你的插入语句中提供它 -
@mj_ 没有抛出异常。它只在第一行读取并停止。
-
很抱歉,我对此很固执,但是“停止”是什么意思?程序完全崩溃了?我们可以注释掉数据库插入行,让它完全运行并确保其他一切正常。 SQL 本身看起来还不错。你能在 MySQL admin/developer 应用程序中尝试一下吗(我不记得它叫什么了)。
标签: java mysql database jdbc text-files