• 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 setBinaryStream

 
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I am having a problem with PreparedStatement.setBinaryStream(1,x,y), it works for files with smaller size but for a file of 15 Mb the file downloads easily but while uploading it returns -1 in statement.executeUpdate(). I looked over many places in google and found that PreparedStatement.setBytes worked for some but it didn't for me and now i am just repeating every methods found in forums but am stuck at the same point , so plzzzzz help me with this.

Thank you in advance.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What driver are you using?
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
driver is probably 4.0......the live production server is in a different country
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What implementation are you using? Oracle? SQL Server? MySQL? DB2? Postgres?

What version and type is the database?

Can you post your code?
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Database is MSSQL 2008

Database type is relational

The code is


this function is called from another page and after this function is completed the program returns -1 in statement.executeUpdate();
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would that be SQL Server 2008 Enterprise Edition, or the developer edition?

What driver implementation are you using? What data type is the target field? Is SQL Server running in a compatability mode less than 100?
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Enterprise edition,
Data type is Image,

I don't have the access to production server database so i don't know about the driver implementation and SQL Server compatibility mode but i can request for those things .... what can i do after getting those parameters...
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't need access to the DB for either. You can query for compatability mode via Entirprise Manager and you will have the driver in your classpath.

The image data type will hold 2GB of data, so its not likely to be the database. Sounds like a driver issue perhaps.
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DBDriver is com.microsoft.sqlserver.jdbc.SQLServerDriver and could you please explain what might be driver issues ..
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of that driver?
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
4.0
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There isn't a version 4.0 as far as I am aware. Where did you get it?

Another question: does the data actually get inserted? Is it just the return value that is the issue?
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know where they got but that is the version of jdbc driver they are using for live production server and local as well.

No the data doesn't get inserted into the db.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm. Well there is no version 4.0 supplied by Microsoft.

Have you tried using another method to set the Binary content? What happens if you define the length? Or use setBlob()?
 
Subash Kshetri
Greenhorn
Posts: 23
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul for helping me but i don't have the exact information about the production server database and have requested those and so i can't figure out what to do unless i get the details of the database and the constraints of the column. Thank you again.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome. Are aware you can get the information you need by querying the database? exec sp_help on the table in question will tell you all you need to know about the table and column. exec sp_dbcmptlevel will tell you the compatability level (though reading the docs this probably does not matter in your case, image has always supported 2GB).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic