[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 941
  • Last Modified:

How to Insert data into a binary field?

Hi,
   Can anyone tell me how to insert data into a binary column?
Regards,
Badri.
0
gvsbnarayana
Asked:
gvsbnarayana
  • 6
1 Solution
 
caner_elciCommented:
How you want to insert that binary data? Usually binary data is inserted by a custom program, but if you want to insert a file or something like that, you can do that, using MS Access:

Open Access,
Create a new database,
Open File | Get External Data  | Link Tables
You'll see a "Link" dialog similar to "Open File
0
 
caner_elciCommented:
Well, accidently submitted previous comment, again:

How you want to insert that binary data? Usually binary data is inserted by a custom program, but if you want to insert a file or something like that, you can do that, using MS Access:

Open Access,
Create a new database,
Open File | Get External Data  | Link Tables
You'll see a "Link" dialog similar to "Open File" dialog.. But when you scroll down the "Files of type"
0
 
caner_elciCommented:
Well, accidently submitted previous comment, again:

How you want to insert that binary data? Usually binary data is inserted by a custom program, but if you want to insert a file or something like that, you can do that, using MS Access:

Open Access,
Create a new database,
Open File | Get External Data  | Link Tables
You'll see a "Link" dialog similar to "Open File" dialog.. But when you scroll down the "Files of type" combo, you'll see "ODBC Database ()" item.. When you select it, you'll have the common ODBC "Select Data Source" dialog.
Create a ODBC Datasource for your MS SQL database, select it
Then you'll see "Link Tables" dialog, which you can use to select the tables you want to insert binary data.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
caner_elciCommented:
Can someone remove my previous comments? There is a problem with my browser..
0
 
gvsbnarayanaAuthor Commented:
Hi caner_elci ,
  My programming language is Java.
I can't change the database to Access.
Any other suggestions?
Regards,
Badri.
0
 
caner_elciCommented:
Okay, then it's easier.. You can use PreparedStatement and setBinaryStream method of it to insert binary data. I might have a sample code for you, looking for that, but in the meantime, you can just try to create a PreparedStatement and set it's parameters, and then execute the statement.

Caner
0
 
caner_elciCommented:
There is a sample code to insert binary data to Oracle database, using BLOBs. It may help you to understand the usage of PreparedStatement. Also you can check original Java documentation. By the way, you can use BLOB/CLOB types for your binary data.

http://www.grallandco.com/blog/archives/2004/10/

0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now