Java JDBC SQL异常 [英] Java JDBC SQL Exception

查看:62
本文介绍了Java JDBC SQL异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Java脚本来将一堆书从冗长的纯文本文件导入数据库.我将所有书籍都解析为书籍对象,并试图将它们写入数据库.但是,我在以下字符串上遇到了一个缺少逗号的异常"ORA-00917:缺少逗号":

I am currently working on a script in Java to import a bunch of books from a lengthy plain text file to a database. I have all of the books parsed into book objects and am trying to write them to the database. However, I get a missing comma exception "ORA-00917: missing comma" on the Following String:

INSERT INTO THE_TABLE VALUES( 'Yes' , '50388,50389' , 'Humanities and Performing Arts' , 'Required' , 'Ember, Carol & Ember, Melvin' , 'Human Culture' , '2nd' , '2012' , 'Pearson' , 'This is for CRN's 4879 & 2486' , '9780205251438' , '50' , 'null' , 'null' , 'null' , 'Spring 2013' , 'ROTN 4270' , 'Required' , 'Ember, Carol & Ember, Melvin,' , 'Human Culture' , 'Pearson,' , '2nd' , 'Edition,' , '2012.' , 'null' , 'Not Applicable' , 'Not Applicable' , 'Not Applicable' , 'Spring 2013' , 'ANTH 270' , '50388,50389' , 'Humanities and Performing Arts' , 'Required' , 'This is for CRN's 15454 & 48456, 'Ember, Carol & Ember, Melvin,' , 'Human Culture' , 'Pearson,' , '2nd' , 'Edition,' , '2012.' , '9780205251438' , '50' , 'null' , 'null' , 'Not Applicable' , 'Not Applicable' , 'Not Applicable' , 'null' , 'null' , 'null' )

我看不到逗号缺失的地方.可能有其他原因导致此异常吗?

I cannot see where there is a comma missing. Could there be another reason for this exception?

推荐答案

, 'This is for CRN's 15454 & 48456,

就在那儿.
请注意,您是如何错过(48456)之后的勾号的.可能是因为(CRN)部分.

Right there.
Notice how you missed a tick after (48456). Probably because the (CRN's) part.

此外,我建议使用record以便于编程.插入这样的值只是一团糟. :)继续努力.

Also, I recommend using a record for ease of programming. Inserting values like that is just messy. :) Keep up the good work.

这篇关于Java JDBC SQL异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆