• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with inserting into MS Access Memo field.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
reply
    Bookmark Topic Watch Topic
  • New Topic