Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:21:02+00:00 2026-06-15T12:21:02+00:00

I am setting an SQL prepared statement like this: prd.setBytes(i+1, temp_value); Where temp_value is

  • 0

I am setting an SQL prepared statement like this:

prd.setBytes(i+1, temp_value);

Where temp_value is of type byte[].

At the end i am adding the prd statement to a batch like this:

prd.addBatch();
prd.executeBatch();

The executeBatch gives me the exception:
java.sql.BatchUpdateException: Error converting data type varbinary to numeric.

Is it possible to simply add Bytes to a prepared statement no matter if the field in the DataBase table is of type Numeric or any other type?

Do i have to be speccific about the type i am inserting?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:21:03+00:00Added an answer on June 15, 2026 at 12:21 pm

    The setBytes method is intended for use with SQL BLOB types, such as varbinary, longvarbinary, and so on. For the numeric types you need to use BigDecimal, BigInteger, or a numeric primitive.

    The issue with allowing setBytes to be used with non-binary types is system independence: you would need to match the driver’s expected layout for a multi-byte number with potentially vey complex structure that JDBC driver writers would need to publish. Once this layout is published, their driver would have to remain compatible with it for life. Most driver writers, however, would prefer to avoid such tight coupling with the client code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a prepared statement + execute batch in order to insert data into
I would like to ask how to simplify the following prepared statement , so
I used the following SQL script to enable setting current time in a field,
I am currently setting the connection string for my linq to sql data context
Some guys where I work are setting up a new database server for SQL
Is there a setting in SQL Server to have null = null evaluate to
Where is the SQL outputting when setting show_sql in NHibernate ? I have ReSharper
I'm setting up a SQL Server 2008 server on a production server, which way
I am releasing a database build to SQL Server 2000 via a batch file
I have a managed bean which makes SQL queries to Oracle database. This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.