I am recoding an old media manager application of mine and have encountered a strange behvaior in an insert into-event.
My table in question is stored in a text file consisting of ";"-delimited fields, so far it's a very small table,
but will be much bigger in the future, but for now I have encountered this column-error that is driving me crazy. For now,
my table look like this in it's text file:
I read in the text file with the following method
In a class called MediaTitleRecord i insert values into the column fields using a PreparedStatement like below:
But this operation results in the following error that is printed out to the console:
I am sorry if I have posted too much code here, but I have tried to keep it down to a small amount. Could anyone
help me to try to figure out what is going on here? Why is my program having trouble with the column ORIG_TITLE in the
TBL_MEDIATITLE - table?
Have you checked the table your text file created? Does it look correct? In your table creating code, you could print the data variable before you execute it. I suspect data has places that it needs spaces. I would replace the ";" with a space, not an empty string. Also, I think the split is unnecessary.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:Have you checked the table your text file created? Does it look correct? In your table creating code, you could print the data variable before you execute it. I suspect data has places that it needs spaces. I would replace the ";" with a space, not an empty string. Also, I think the split is unnecessary.
Best, Mr Snortum!
Thank you so much for the reply. Would you be so kind and show me an example of code that describe the problem in question. I have tried the table creating code without a split but I don't wan't the table structure consist of one single line in the text file so thats why I am using a split. I am a little confused. Sorry. Which data variable do you refer to?
Knute Snortum wrote:I believe this is all you need:
Best, Mr. Snortum!
I changed the code in my openFile(Connection conn, String fileName) method and applied the code after your example
so now the method in question looks like this
And when i now insert a record in the table tbl_mediatitle in the class MediaTitleRecord that extends a thread object (as showned above in this post) everything seems to work fine!! Was this a space error in the table creating method? I think it was that. Thank you so much for your kind reply it saved me from a lot of headaches. I believe this subject has come to a close now, thank you so much again.