• 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

Servlet-JDBC with Access databse

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Friends,
I am working on a form and using servlet to submit data into database. I am using simple JDBC-ODBC bridge and using MS-Access as databse. In my table their is one column with field type "memo" which can hold upto 65,535 chractes. When from my form i am inserting values in this column it is only accepting a string of lenght 256 char and not more. Why is it behaving in such way?
Can any one help me in this. I have posted this query here because lot of user in this forum must be using Servlet-JDBC and i think i will get my answer here.
Am i right?
thanks,
regards,
Raj.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i guess u might be using GET method in your form. check for it, n if yes change it to POST. am i rite folks?
 
Rajpal Kandhari
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
No the pb is not with the type of method i have choosen. I am using doPost method. I am getting error when it is inserting data in the database. It is inserting data correctly for all other type of column fields. that is text, number, date/time, autonumber. Only for memo field it is only accepting upto 256 characters and nothing more than that.
It gives me following erroe
java.sql.SQLException String Data, right Truncated (null).
It is a MS-ODBC error.

How to sole it. Any one pls help me?
Regards,
Raj.
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess would be that this has nothing to do with servlets...
It has alot to do with your jdbc driver...
Walk thru the following and you might find your problem...
#1 what are the java data types you are using...
#2 what are the sql data types you are using...
#3 what are the db engine datatypes you are using...
My guess is that the jdbc driver being invoked is translating you memo field into a text field... my ms-acces is rusty so bear with me.
Test you code outside of the servlet....
If it works as you expect... Check you CLASSPATH. You are invoking a different jdbc driver....
Otherwise you have just found a limitation of your database driver!
Good-luck you a blazing a trail i will be following next week.

------------------
We learn more from our mistake's than from our success's.
a.k.a. monty6
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Memo fields are wierd in Access. They cause all sorts of problems with the JDBC-ODBC driver unless you use the stream method of accessing them.
To read from a Memo field, use
InputStream in = resultset.getAsciiStream(int column)
or
InputStream in = resultset.getAsciiStream(String colname)
I have never had to write to a memo field, but I assume the process is similar.
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've also moved this to the JDBC forum, where it would be more appropriate.
 
There's a hole in the bucket, dear Liza, dear Liza, a hole in the bucket, dear liza, a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic