473,889 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Picture with Postgres and Delphi

Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 11 '05
48 11957
On Wednesday 10 September 2003 21:36, Micha³ Zaborowski wrote:
Darko Prenosil wrote:
There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq
has great support for large objects, and you can store large object
without actually storing them on server filesystem, so You do not need
any file permissions on "upload directory" or something like that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...
If You are using Delphi, there is great project called "Zeos objects",
and if I remember correctly it has support for large objects.


Zeos are useing a lot of memory...

Regards,
Micha³ Zaborowski (TeXXaS)

I do not remember that this was the problem whan I used it. I was also diging
through that code, because I was writing something similar to dataset for QT.
What actually "Zeos are useing a lot of memory..." means ? A lot of alocated
space for result ?

Regards !

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #41
>> If You are using Delphi, there is great project called "Zeos
objects", and if I remember correctly it has support for large
objects.

Zeos are useing a lot of memory...


Another issue I had with Zeos was that when I looked into possibly using
those components (this was probably over a year ago now), and tried
connecting to a database which is configured for md5 password encryption,
I got some kind of error message about that (md5 password authentication)
not being supported. Perhaps it works differently now, but be forewarned
to look at that if you need that type of authentication for your
database.

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #42
>> There is no need for manually storing files on filesystem, because
large objects are doing that for You. I am storing whole binary files
in blobs(synonym for large objects from some other platforms), and I do
not remember that I had a single problem with that. Do not forget that
libpq has great support for large objects, and you can store large
object without actually storing them on server filesystem, so You do
not need any file permissions on "upload directory" or something like
that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...

[sNip]

Has anyone done any benchmarks on this to know what the performance
differences are for downloads (I'm not concerned about uploads since they're
far less frequent) from a web server such as Apache HTTPd accessing the file
system directly vs. a CGI script/program sending it dynamically through
Apache HTTPd?

--
Randolf Richardson - rr@8x.ca
Inter-Corporate Computer & Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.8x.ca/

This message originated from within a secure, reliable,
high-performance network ... a Novell NetWare network.

Nov 12 '05 #43
Randolf Richardson, DevNet SysOp 29 wrote:
There is no need for manually storing files on filesystem, because
large objects are doing that for You. I am storing whole binary files
in blobs(synonym for large objects from some other platforms), and I do
not remember that I had a single problem with that. Do not forget that
libpq has great support for large objects, and you can store large
object without actually storing them on server filesystem, so You do
not need any file permissions on "upload directory" or something like
that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...


[sNip]

Has anyone done any benchmarks on this to know what the performance
differences are for downloads (I'm not concerned about uploads since they're
far less frequent) from a web server such as Apache HTTPd accessing the file
system directly vs. a CGI script/program sending it dynamically through
Apache HTTPd?


CGI will be slow. Of course.

If you write fastCGI, that would be hell lot fast. For ultrafast static content
delivery, you should use small web servers like boa. It outperforms apache2 by
upto 3 times for statis delivery..

Shridhar
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #44
Randolf Richardson, DevNet SysOp 29 wrote:
There is no need for manually storing files on filesystem, because
large objects are doing that for You. I am storing whole binary files
in blobs(synonym for large objects from some other platforms), and I do
not remember that I had a single problem with that. Do not forget that
libpq has great support for large objects, and you can store large
object without actually storing them on server filesystem, so You do
not need any file permissions on "upload directory" or something like
that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...


[sNip]

Has anyone done any benchmarks on this to know what the performance
differences are for downloads (I'm not concerned about uploads since they're
far less frequent) from a web server such as Apache HTTPd accessing the file
system directly vs. a CGI script/program sending it dynamically through
Apache HTTPd?


CGI will be slow. Of course.

If you write fastCGI, that would be hell lot fast. For ultrafast static content
delivery, you should use small web servers like boa. It outperforms apache2 by
upto 3 times for statis delivery..

Shridhar
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #45
[sNip]
CGI will be slow. Of course.

If you write fastCGI, that would be hell lot fast. For ultrafast static
Well, MOD_PERL and DBI.pm are part of the equation. So is NetWare,
which is still the undisputed champion of file and print servers.
content delivery, you should use small web servers like boa. It
outperforms apache2 by upto 3 times for statis delivery..


Do you know if BOA has been ported to NetWare? If not, then it's
simply not an option for me as one of my requirements is cross-platform
support. Apache is extremely flexible, and so it has been difficult for me
to justify anything else, but I am certainly open to looking at other
options for handling some aspects of this project.

Apache 2 also has options to load entire directories of files into RAM
for faster access. Although I haven't tested this yet, the concept seems
very good and I will probably use it for all the long-term static content
in my future projects.

--
Randolf Richardson - rr@8x.ca
Inter-Corporate Computer & Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.8x.ca/

This message originated from within a secure, reliable,
high-performance network ... a Novell NetWare network.

Nov 12 '05 #46
[apologies -- this amounts to a cross-post on subject "DB with bytea
types reload problem" -- I'm fairly desperate!]

Hi Jonathan

I saved a db with some bytea columns to text using

pg_dump -a -d <db> > out.sql

If I go

psql: \i out.sql

multiple errors result, such as:

psql:out.sql:50 5: invalid command \N
psql:out.sql:50 5: invalid command \

The sql dump file has lines starting something like this for the photo table:
1 500 375 h \\377\\330\\377 \\340\\000\\020 JFIF\\000\\001\ \001\\001\\000H \\000H\\000\\00 0\\377\\341\\02 3>Exif\\000\\00 0MM\\000*\\000\ \000\\000\\010\ \000\\012\\00.. ..

Is there any way I can retrieve the image data?

Rory

On 10/09/03, Jonathan Bartlett (jo*****@eskimo .com) wrote:
What is the size limit of bytea, I thought it was 8K?
No limit that I've found. Some are several meg.
How do you dump your database when you have bytea, do you need to do a
binary dump?


Nope. pg_dump automagically escapes everything.

--
Rory Campbell-Lange
<ro**@campbel l-lange.net>
<www.campbell-lange.net>

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #47
It's always worked for me just by typing from the command line:

psql -U USERNAME DBNAME < backup.sql

Jon

On Tue, 16 Dec 2003, Rory Campbell-Lange wrote:
[apologies -- this amounts to a cross-post on subject "DB with bytea
types reload problem" -- I'm fairly desperate!]

Hi Jonathan

I saved a db with some bytea columns to text using

pg_dump -a -d <db> > out.sql

If I go

psql: \i out.sql

multiple errors result, such as:

psql:out.sql:50 5: invalid command \N
psql:out.sql:50 5: invalid command \

The sql dump file has lines starting something like this for the photo table:
1 500 375 h \\377\\330\\377 \\340\\000\\020 JFIF\\000\\001\ \001\\001\\000H \\000H\\000\\00 0\\377\\341\\02 3>Exif\\000\\00 0MM\\000*\\000\ \000\\000\\010\ \000\\012\\00.. ..

Is there any way I can retrieve the image data?

Rory

On 10/09/03, Jonathan Bartlett (jo*****@eskimo .com) wrote:
> What is the size limit of bytea, I thought it was 8K?


No limit that I've found. Some are several meg.
> How do you dump your database when you have bytea, do you need to do a
> binary dump?


Nope. pg_dump automagically escapes everything.

--
Rory Campbell-Lange
<ro**@campbel l-lange.net>
<www.campbell-lange.net>

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #48
Rory Campbell-Lange <ro**@campbel l-lange.net> writes:
I saved a db with some bytea columns to text using
pg_dump -a -d <db> > out.sql


You should not need a binary dump for bytea. However, in versions
before 7.3.5 there is a potential for problems if the data goes through
any kind of locale or encoding translation --- see
http://archives.postgresql.org/pgsql...1/msg00140.php

I'm not sure if that's what happened to you, or if there's any easy way
to reverse the conversion on your file if that is what happened, but
it's an avenue to pursue.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #49

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

Similar topics

3
8712
by: warwick.poole | last post by:
I am interested in finding out about Enterprise scale Postgres installations and clustering, especially on Linux. Essentially I would like to know the possibility that Postgres can store the database data in a central location (ex: on a SAN fiber array) and have a cluster of machines sharing processor/RAM/IO bandwidth to do the application processing. Or perhaps there is another solution similar to what www.emicnetworks.com have...
18
5160
by: Joe Lester | last post by:
This thread was renamed. It used to be: "shared_buffers Question". The old thread kind of died out. I'm hoping to get some more direction by rephrasing the problem, along with some extra observations I've recently made. The core of the problem is that Postgres is filling up my hard drive with swap files at the rate of around 3 to 7 GB per week (that's Gigabytes not Megabytes) . At this rate it takes roughly two months to fill up my 40...
1
2456
by: eric_berlin | last post by:
I am writing a multithreaded application that has 6 threads each writing 5 frames per second video bitmaps to a different picture box. I have just found out that only the main UI thread is supposed to interact with Windows Fourms. What is the fastest way to have a non UI thread safely write a bit map to a picture box?
0
2709
by: NM | last post by:
Hello, I've got a problem inserting binary objects into the postgres database. I have binary objects (e.g. images or smth else) of any size which I want to insert into the database. Funny is it works for files larger than 8000 Bytes. If a file is less than 1000 Bytes I get the following message: Error message: --invalid input syntax for type oid: "\074\077......";
0
2284
by: varathasiva | last post by:
Dear All, I have one Delphi 7 application software.In that software i am using backend for PostgreSQL 8.1 with linux server fedura version.I am using this software through internet.After getting more data in PostgreSQL database server will be slow.In delphi 7 i am using data access component Zeos Lib.I cann't fund where is the problem.Please advice where is the problem.Advance thanks to all. Kindly Regards Siva
0
9810
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11203
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
10896
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
9612
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...
1
7999
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7151
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
5830
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...
1
4650
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
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.