Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am.programming an.application in which i am selecting data from postgres database and table name cards.

In.cards we have many columns but two.columns are bytea datatype. It has a blob saved one.column is named as tpl and other is photo but when i select data and fill datatable through dataAdapter the datable shows theese two column values as System.Byte[] and when i insert it in my master database it.insert it as System.Byte[] it is loosing.the binary data which is in the column. I have to.syncrhonize local server tables to master server . We have different gates in our company where passes are issued and.then.they are synchrinized to a central sever ..

I hope you people get my point please help

Databae is postgresql 8.2 Apllication is on.c#

share|improve this question
    
"I have to synchronize local server tables to master server." — why not use replication. (Also, upgrade that Postgres install. That version is no longer maintained for security.) –  Denis Nov 11 '13 at 20:03
    
Thanx for your reply but you must know that company doesnot want to switch to other version they ate very dumb.if you have a good suggestion for replication.let me.know we have 10 gates each has local server running and it my sync application.sync data to central and some time the local server sync from master to insert and update the local so its a two way syncrhonize ... –  Shakoor Alam Nov 11 '13 at 20:08
    
    
Which one should i adopt –  Shakoor Alam Nov 11 '13 at 20:28
    
PostgreSQL 8.2 ? Seriously? Are you using nPgSQL? Something else? –  Craig Ringer Nov 12 '13 at 1:31

1 Answer 1

I've worked on a db system before where it used dblink connections for controlling the data transfer between postgres servers of different versions. This included transferring of bytea data and maintaining the data type. Dblink connections are a little restrictive and I can't speak for connection time overheads however they serve their purpose well for data transfer.

On the main server the data was pulled in from the satellites:

INSERT INTO main_table
SELECT * FROM dblink("connect_string", ''SELECT tpl, photo FROM satellite_table;'')
AS data(tpl bytea, photo bytea);

This allows you to specify the incoming data types specifically. Not sure if this helps but I've seen this working fine on an 8.3 db. http://www.postgresql.org/docs/8.3/static/contrib-dblink.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.