Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with inserting into MS Access Memo field.

 
Stavya Grover
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have an ODBC named store in MS Access. There's a table called desc which has bookId(Number) and summary(Memo).
My code to insert data into the table is:




The output which I am getting in Netbeans is:

Errors!
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
BUILD SUCCESSFUL (total time: 0 seconds)

Any help,please?
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried the following:
- psumm.setString(2, summary);
- psumm.setCharacterStream(2, new StringReader(summary));
- psumm.setClob(2, new StringReader(summary));

Or, for unicode:
- psumm.setNString(2, summary);
- psumm.setNCharacterStream(2, new StringReader(summary));
- psumm.setNClob(2, new StringReader(summary));
 
Stavya Grover
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. The table in MS Access cannot have a name desc, so changed the name,still, the above are not working.
2. setString gives : General error
3.psumm.setCharacterStream(2, new StringReader(summary)); gives: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
4.psumm.setClob(2, new StringReader(summary)); also gives: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect


Is there a way to convert the string to a Clob and then use setClob()? And if I am using CLOBS, the data type in MS Access should be what?
I've got a project to submit tomorrow, this is taking too much time! Can't find the solution, I just need to store looooooong strings in MS Access. Suggest a way,please!

 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few more attempts:

You can also try to convert the column to Text. If I recall correctly that can handle large amounts of text as well.
 
Stavya Grover
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked!

I just had to change the table name to something else than desc. The code I posted worked with memo.
I'll try out your suggestions also. Thanks!
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic