Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing an image in P.SQL 2000i 1

Status
Not open for further replies.

dgillz

Instructor
Mar 2, 2001
10,038
US
Are Image fields supported in P.SQL 2000i? I specifically want to store .bmps and .jpgs in a datasbase, then display them later in a crystal report. Any input on this would be appreciated. Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
There is no specific Image type in P.SQL, There are two real options. One, store the data in a LongVarBinary field. Two, create a link to the image and store the image as a separate file. Personally, I would recommend option two. It'll be easier and you won't inflate the database with extraneous information like the binary data of an image. mirtheil@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
I have the same problem, also using crystal reports, but I have to use option 1 (I'll have only one record in my table, so the size won't be a problem). I created a LongVarBinary field in my table. How do I store a .bmp picture in that field?
Any help would be appreciated.
 
To store the data in the LongVarBinary, you'll need to write an application that takes the BMP, reads it in and then writes it out to the Pervasive database. That will only get you half way. You'll also need to write the code to read the LongVarBinary and write it to BMP so that it can be displayed by the application.
You didn't give which interface you want to use so the description of what needs to be done is vague.
info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
Tamina,

If Mirtheil's suggestion works. Crystal reports can put the image on the report. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Mirtheil,
I didn't realise it would be so tricky, I'm quite new to this stuff. I'm using PDAC components with Delphi6.

Dgillz,
I tried the CR part of this task, using a BLOB-field with an access-database, it worked just fine. Unfortunately, I must use a btrieve-database.

Thank you both for helping.
 
Off hand, I haven't done PDAC and images. Have you tried standard BDE controls pointing to ODBC? How big are these images? I'd still suggest using the link and saving the images as files instead of storing them in the Btrieve files.
info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
Good news for me - we'll find some other way to store the image, it doesn't have to be in btrieve. So, it will be eather a link pointing to the image, or a stored image in a database other than btrieve.
I'm leaving this problem to someone less lucky :)
Thanks
 
Tamina,
I`m much less lucky than you are!

Mirtheil,
I have to make tests with Pervasive.SQL2000i, including those importing image files (jpg, 10kb each) into LONGVARBINARY field. Using JDBC driver through a tool written in Java (DB-Dude).
Completely new to Pervasive. I have already made this on Oracle, PostgreSQL (Win, Lin) and MS SQL Server.
Now I have have to overcome this last barrier on the way to happiness!

As far as I could see from the discussion there is no way doing that by a function or utility. (Or maybe there is?!) What kind of program am I to write?

I would appreciate any help.
 
Why do you want to store the image in the Btrieve file? I can't think of any reasons to do that. I can think of several reasons not to do it.. 1. It's not as easy as putting a link or a location into the database. 2. It'll be faster to read (since you only have to read the record and display the image instead of reading the record and the image, then converting the image into an image format then writing it to disk, then displaying the image). 3. There's no "image" type in Btrieve/P.SQL. That makes writing the program more complex. You will have to store the image in an appropriate binary data type (LongVarBinary), write the code to read the image in, write it in the LongVarBinary format, and then the code to read the LongVarBinary format, then write it to an image. It's just not smart. Store the image as a link. It'll make your life a lot easier. info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
Mirtheil,
Thanx. But my tests are to compare the time needed in different DBMS for storing binary images, not the characters (you mean them by links, don`t you?).
Can it be realized in Java, using expressions like setBinaryStream(..), and then executeUpdate() ?
Is there something special in LONGVARBINARY format to do with JPGs? Could you please give me a clue or a snippet if you have?
Thank you in advance.

 
I am also planning to store images in the pervasive database as a longvarbinary. I would love to get around it and store them as image files. However to my understanding, if I store say 50,000 to 100,000 images to a directory, it would be painfully slow having windows search for the files. Please tell me as a newbie if I am misguided.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top