aspose file tools*
The moose likes JDBC and the fly likes Problem with JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with JDBC " Watch "Problem with JDBC " New topic
Author

Problem with JDBC

Syed Dastagir
Greenhorn

Joined: Dec 06, 2001
Posts: 1
Hi,
I am using Stored procedure to access a table in Sql Server
7.0.I have a text datatype for one of the fields in the table.
When i access the field for insert using cs.setString()with say
1MB of text the server throws exception. When i use
cs.setAsciiStream instead of cs.setString , am getting exception
when i access the output param. I think this may be a driver
problem. I would like to know whether any of them come accross
this problem and solved it. Any suggesions will be a great help
for me. I have also given the coding below.

Thanks
syed
[ Edited by Dave to format code ]
[This message has been edited by David O'Meara (edited December 06, 2001).]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Two things, if you try using the JdbcOdbcDriver you will always run in trouble. It doesn't implement all JDBC methods and it isn't very stable.
Secondly: My view (and I'm no DBA) is don't put a 1Mb file in the database. Personally I'd store a reference to where the file is stored externally or something.
Dave.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

sent via email:
Hi david,
I got ur reply. Thanks for responding. Since i get the text from the form(its a description field) and storing it in the DB, there is no chance for storing it in the file. And more over there will be no security. If say am storing some 10000 recs then managing my files will become hectic problem.

Thanks
syed

(Sorry I can't usually reply via email, and it means no-one else can get a say )
If you are getting the data via a HTML form, you can either use a multipart/form-encoded upload, save it to the local file system and save the filename in the db, or receive the data as a form field, write it as a unique file name (since you control the data) and once again save the file name in the DB.
The other problem I've seen that you may run into if you try to store the data direct top the DB is that there are often still upper limits on how large LOB types can be (32k or so? I can't remember)
Dave.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JDBC