473,739 Members | 6,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open binary file directly from BLOB

Hi,

Can someone suggest the best technique / method of opening a Word ( or any
other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field to a
binary disk file and can then open it. It would be better for them to be
able to just open the file directly for viewing etc. I can 'trigger' a load
for the file myself, but Im sure there must be a 'slick' method using some
sort of 'memory' files, without needing to explicitly write the file to
disk first ?

One Issue I can forsee is determining the application required to open the
file. Also what would happen if the user modified and tried to save it ? Or
do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon
Aug 7 '06 #1
4 5092
Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that, then
you can feed the contents into Word from memory. However, you would have to
manage when it is saved (since there is no option in Word to save the file
to memory, only to disk), calling the Save method on the IPersistMemory
interface yourself when you wanted to commit the contents back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bishman" <jo************ *@btinternet.co mwrote in message
news:uH******** ******@TK2MSFTN GP04.phx.gbl...
Hi,

Can someone suggest the best technique / method of opening a Word ( or any
other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field to
a binary disk file and can then open it. It would be better for them to be
able to just open the file directly for viewing etc. I can 'trigger' a
load for the file myself, but Im sure there must be a 'slick' method using
some sort of 'memory' files, without needing to explicitly write the file
to disk first ?

One Issue I can forsee is determining the application required to open the
file. Also what would happen if the user modified and tried to save it ?
Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon

Aug 7 '06 #2
Thanks ( again ) Nicholas

Shame there is nothing 'slicker' but then its good in one way as its less
for me to code !!

Cheers for the response

Jon
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that, then
you can feed the contents into Word from memory. However, you would have
to manage when it is saved (since there is no option in Word to save the
file to memory, only to disk), calling the Save method on the
IPersistMemory interface yourself when you wanted to commit the contents
back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bishman" <jo************ *@btinternet.co mwrote in message
news:uH******** ******@TK2MSFTN GP04.phx.gbl...
>Hi,

Can someone suggest the best technique / method of opening a Word ( or
any other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field
to a binary disk file and can then open it. It would be better for them
to be able to just open the file directly for viewing etc. I can
'trigger' a load for the file myself, but Im sure there must be a 'slick'
method using some sort of 'memory' files, without needing to explicitly
write the file to disk first ?

One Issue I can forsee is determining the application required to open
the file. Also what would happen if the user modified and tried to save
it ? Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon


Aug 7 '06 #3
Bishman,

Maybe it will be easy to handle if you leave those Word files to the OS and
keep a link in DB.

chanmm

"Bishman" <jo************ *@btinternet.co mwrote in message
news:%2******** *******@TK2MSFT NGP06.phx.gbl.. .
Thanks ( again ) Nicholas

Shame there is nothing 'slicker' but then its good in one way as its less
for me to code !!

Cheers for the response

Jon
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote
in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that,
then you can feed the contents into Word from memory. However, you would
have to manage when it is saved (since there is no option in Word to save
the file to memory, only to disk), calling the Save method on the
IPersistMemo ry interface yourself when you wanted to commit the contents
back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bishman" <jo************ *@btinternet.co mwrote in message
news:uH******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Hi,

Can someone suggest the best technique / method of opening a Word ( or
any other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL Binary
field working fine, but the user 'saves' the file from the Binary field
to a binary disk file and can then open it. It would be better for them
to be able to just open the file directly for viewing etc. I can
'trigger' a load for the file myself, but Im sure there must be a
'slick' method using some sort of 'memory' files, without needing to
explicitly write the file to disk first ?

One Issue I can forsee is determining the application required to open
the file. Also what would happen if the user modified and tried to save
it ? Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon



Aug 8 '06 #4
Yeah, I have seen other people advise this as well and its a fair
point.....to which I dont really have a particuarly strong response other
than the DB gets treated with a degree of respect from the backup and
security point of view, and it does provide that almost 'physical ' link
between the rest of the data associated with the BLOB and the BLOB itself.
"chanmm" <ch*****@hotmai l.comwrote in message
news:eH******** ******@TK2MSFTN GP06.phx.gbl...
Bishman,

Maybe it will be easy to handle if you leave those Word files to the OS
and keep a link in DB.

chanmm

"Bishman" <jo************ *@btinternet.co mwrote in message
news:%2******** *******@TK2MSFT NGP06.phx.gbl.. .
>Thanks ( again ) Nicholas

Shame there is nothing 'slicker' but then its good in one way as its less
for me to code !!

Cheers for the response

Jon
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote
in message news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>Jon,

It pretty much is. You could probably load a new Word document, and
then query it for the IPersistMemory interface. If it supports that,
then you can feed the contents into Word from memory. However, you
would have to manage when it is saved (since there is no option in Word
to save the file to memory, only to disk), calling the Save method on
the IPersistMemory interface yourself when you wanted to commit the
contents back to memory.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bishman" <jo************ *@btinternet.co mwrote in message
news:uH****** ********@TK2MSF TNGP04.phx.gbl. ..
Hi,

Can someone suggest the best technique / method of opening a Word ( or
any other ) Document from an SQL BLOB ?

I have the process of saving and retrieveing the file from an SQL
Binary field working fine, but the user 'saves' the file from the
Binary field to a binary disk file and can then open it. It would be
better for them to be able to just open the file directly for viewing
etc. I can 'trigger' a load for the file myself, but Im sure there must
be a 'slick' method using some sort of 'memory' files, without needing
to explicitly write the file to disk first ?

One Issue I can forsee is determining the application required to open
the file. Also what would happen if the user modified and tried to save
it ? Or do you just use a 'viewer' / view only mode ?

Is saving it to disk first actually the required technique ?

Thanks in advance.

Jon



Aug 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
10436
by: Phil Palmieri | last post by:
Im using md5 to encrypt and decrypt plain text, this works fine... When i try to run the same function on a binary file, it does not decrypt correctly. Is there a way to encrypt binary files correctly, and be able to decrypt them? in the perfect situation i would like to be able to store the encrypted binary file into a mysql blob field, or at least be able to save an encrypted version of the binary file on the server.
3
5589
by: David Stockwell | last post by:
Hi, I'd like to read the contents of a file into memory. The problem is that this file is binary. I then want to store the whole thing in memory to a database as a blob. I have no problem reading from a file: I did this: import os f = open('/bin/ls' , 'r+b') data = f.read()
1
5828
by: Rune Hansen | last post by:
I'm storing gzipped data in a MySQL blob field. I can fetch the blob and "wb" write the data to a file. It becomes a file containg gz data. I can't take the same data and do anything sensible with it in python - like say zlib.decompress(data). How can I convert the binary data from the blob field to the gzipped string it was stored as (java stores the string, Pickle is not an option)? regards
10
5237
by: Peter Stojkovic | last post by:
I want store an integer-array of 1000 Values in a blob in a SQL-database. I will do this every 10 Seconds. How can I do this ???? What datatypes a have to use ??? Thanks
0
2342
by: Wescotte | last post by:
I'm abit confused on how to work with binary data with an ODBC connection (My database is DB2 btw) Say I have a table like CREATE TABLE EJWLIB.BLOBTEST ( ID NUMERIC(5) NOT NULL, FILENAME VARCHAR(128) NOT NULL, BINARY BLOB(2M) ) Now I (I assume this is the correct method) insert data in the
21
2573
by: Mike | last post by:
Hi, The example below shows that result of a marshaled data structure is nothing but a string >>> data = {2:'two', 3:'three'} >>> import marshal >>> bytes = marshal.dumps(data) >>> type(bytes) <type 'str'>
2
6540
by: Bill Nguyen | last post by:
I need sample code to insert binary file (mappoint map file) into a varbinary column using VB.NET. Please help! Thanks Bill
7
1597
by: Rudi Menter | last post by:
Hi, I would like to store binary data (as data-type blob) in a (MySql-) database, so I require functionality that allows a mapping from and back into the filesystem. Now, is there a library for this task that you know of? Thx, Regards --
7
2651
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a download script, so customers on the website can download MP3s to their harddrive (rather than merely listen to it in their browsers):
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.