Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Importing images from MS Access
Importing images from MS Access [message #458908] Tue, 26 July 2005 07:37 Go to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi newsgroup,

currently I am trying to import data from a MS Access Database to a Java
SWT Application. I connected to the databse using the jdbc-odbc-bridge.

The database contains images. The only possibility to store images in
Access is to use the "OLE" field type. I can read the OLE data using
ResultSet.getBytes() but i cannot find a way to convert the data in such
a way that I can construct a swt Image using this data.

Unfortunately I have virtually no knowledge about OLE, so can anyone
give me a hint?

Thank you very much in advance,
Friederich

--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: Importing images from MS Access [message #458914 is a reply to message #458908] Tue, 26 July 2005 11:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joerg.von.frantzius.artnology.nospam.com

Friederich Kupzog schrieb:

> Hi newsgroup,
>
> currently I am trying to import data from a MS Access Database to a Java
> SWT Application. I connected to the databse using the jdbc-odbc-bridge.
>
> The database contains images. The only possibility to store images in
> Access is to use the "OLE" field type. I can read the OLE data using
> ResultSet.getBytes() but i cannot find a way to convert the data in such
> a way that I can construct a swt Image using this data.
>
> Unfortunately I have virtually no knowledge about OLE, so can anyone
> give me a hint?
>
> Thank you very much in advance,
> Friederich
>
Have you made sure that the bytes you get isn't just the image bytes?
Have you tried

InputStream inputStream = new
ByteArrayInputStream(rs.getImageBytes());
result = new ImageData(inputStream);
Re: Importing images from MS Access [message #458949 is a reply to message #458914] Wed, 27 July 2005 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: joerg.von.frantzius.artnology.nospam.com

Joerg von Frantzius schrieb:

> Friederich Kupzog schrieb:
>
>> Hi newsgroup,
>>
>> currently I am trying to import data from a MS Access Database to a Java
>> SWT Application. I connected to the databse using the jdbc-odbc-bridge.
>>
>> The database contains images. The only possibility to store images in
>> Access is to use the "OLE" field type. I can read the OLE data using
>> ResultSet.getBytes() but i cannot find a way to convert the data in such
>> a way that I can construct a swt Image using this data.
>>
>> Unfortunately I have virtually no knowledge about OLE, so can anyone
>> give me a hint?
>>
>> Thank you very much in advance,
>> Friederich
>>
> Have you made sure that the bytes you get isn't just the image bytes?
> Have you tried
>
> InputStream inputStream = new
> ByteArrayInputStream(rs.getImageBytes());
> result = new ImageData(inputStream);
>
Sorry that should read

InputStream inputStream = new
ByteArrayInputStream(rs.getBytes(colIndex));
result = new ImageData(inputStream);

But you probably have tried it. What kind of image are they, is it JPEG,
GIF or something else? Maybe it's just something exotic that SWT doesn't
support directly? The point being here that there might not be any OLE
programming necessary.
Re: Importing images from MS Access [message #458973 is a reply to message #458949] Wed, 27 July 2005 15:48 Go to previous message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi Joerg,

thanks for your reply. Unfortunately this does not work, I get a
Exception (unrecognised format).

The problem is that there can be any image format in these silly OLE
fields. Users simply cut&paste data from any source into the original
Access database. There might even be a Word document in it. I thought
there might be a way to retrieve information about the OLE content type
and then get the data somehow.

Anyone has any other idea?

Thanks a lot
Friederich


Joerg von Frantzius wrote:
> InputStream inputStream = new
> ByteArrayInputStream(rs.getBytes(colIndex));
> result = new ImageData(inputStream);
>
> But you probably have tried it. What kind of image are they, is it JPEG,
> GIF or something else? Maybe it's just something exotic that SWT doesn't
> support directly? The point being here that there might not be any OLE
> programming necessary.


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Previous Topic:SWT exception kills VM
Next Topic:HIDE_SELECTION in Table
Goto Forum:
  


Current Time: Fri Apr 26 03:51:37 GMT 2024

Powered by FUDForum. Page generated in 0.03598 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top