How to Insert data into a binary field?

Hi,
   Can anyone tell me how to insert data into a binary column?
Regards,
Badri.
LVL 8
gvsbnarayanaAsked:
Who is Participating?
 
caner_elciConnect With a Mentor Commented:
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
 
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.