Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > Dataim****t fro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3170 of 3323
Post > Topic >>

Dataim****t from remote db

by tobias.schoenit@[EMAIL PROTECTED] ("Schoenit, Tobias AT/BHL-ZTPS") Jul 11, 2008 at 01:34 PM

Hello,

i have several machines having the same database layout. Now i want
im****t data from a remote machine.=20

I tried something like this but maybe there is a better way in doing
such a thing???

CREATE OR REPLACE FUNCTION im****t_sc(text)
  RETURNS int4 AS $$
	DECLARE
		v_host		ALIAS FOR $1;
		v_return	int4;
		v_constr	text;
		v_config		record;
		temp		record;
	BEGIN
		v_constr :=3D 'hostaddr=3D' || v_host || ' dbname=3Dconfig
user=3Duser password=3Dpass';

		-- connect to remote database
		PERFORM 'SELECT dblink_connect(''con'', v_constr);';
		RAISE NOTICE 'connected';

		FOR v_config in (SELECT * from  dblink('''con''',
'SELECT * from config ') AS
		  hc(id character(36), name text))=20
		LOOP
			INSERT INTO config (id, name) values
(v_config.id, v_config.name);
		END LOOP;

		PERFORM 'SELECT dblink_disconnect (''con'');';
=09=09
		v_return :=3D 4;
		RETURN v_return;

	END;
$$ LANGUAGE 'plpgsql';


But now I get:
NOTICE:  connected

ERROR:  could not establish connection
DETAIL:  missing "=3D" after "'con'" in connection info string

CONTEXT:  PL/pgSQL function "im****t_sc" line 13 at FOR over SELECT rows

********** Fehler **********

ERROR: could not establish connection
SQL Status:08001
Detail:missing "=3D" after "'con'" in connection info string
Kontext:PL/pgSQL function "im****t_sc" line 13 at FOR over SELECT rows


What does that mean?

Thank you very much.
Tobias

--=20
Sent via pgsql-novice mailing list (pgsql-novice@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice
 




 2 Posts in Topic:
Dataimport from remote db
tobias.schoenit@[EMAIL PR  2008-07-11 13:34:04 
Re: Dataimport from remote db
tgl@[EMAIL PROTECTED] (T  2008-07-11 10:10:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 5:58:13 CST 2008.