dblink

Why does DbMetal Generate Table Attribute with “main”?

一笑奈何 提交于 2019-12-20 05:16:14
问题 I'm a newbie with DBLink and Sqlite. When DbMetal generates Nortwind.cs (C#) it marks some methods with a Table attribute: [Table(Name="main.Categories")] // C# After I used DbMetal to create a Nortwind.vb (VB.Net) file, the test program aborted because there was no table named "main.Categories". However, when I removed "main.", it works: ' VB.Net <Table(Name:="Categories")> _ I'm just not understand why "main" is generated at all. Why does it work for C# but not for VB.Net? 回答1: DbMetal

Drop or create database from stored procedure in PostgreSQL

早过忘川 提交于 2019-12-20 02:16:11
问题 I have a function that looks like this: BEGIN DROP DATABASE IF EXISTS db_1; END; I'm getting the following error: ERROR: DROP DATABASE cannot be executed from a function or multi-command string. Is it not possible to drop a database from a stored procedure in PostgreSQL? I'm using plpgsql. 回答1: The error message is just a s clear as the manual on this: DROP DATABASE cannot be executed inside a transaction block. A plgpsql function is surrounded by a transaction block automatically. The long

How to create a DB link between two oracle instances

橙三吉。 提交于 2019-12-18 07:29:12
问题 How to create a DB link between two Oracle instances. Let's say A and B are two instances. I want to access the data in instance B from the instance A. 回答1: as a simple example: CREATE DATABASE LINK _dblink_name_ CONNECT TO _username_ IDENTIFIED BY _passwd_ USING '$_ORACLE_SID_' for more info: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm 回答2: If you want to access the data in instance B from the instance A. Then this is the query, you can edit your respective

How to use (install) dblink in PostgreSQL?

不羁的心 提交于 2019-12-17 02:49:07
问题 I am used to Oracle and to create a dblink in my schema and then access to a remote database like this: mytable@myremotedb , is there anyway do to the same with PostgreSQL? Right now I am using dblink like this: SELECT logindate FROM dblink('host=dev.toto.com user=toto password=isok dbname=totofamily', 'SELECT logindate FROM loginlog'); When I execute this command I get the following error: HINT: No function matches the given name and argument types. You might need to add explicit type casts.

Syntax error in function using dblink to replicate new data

被刻印的时光 ゝ 提交于 2019-12-13 20:53:18
问题 I never created a function in Postgres, I followed some tutorials and made this code, but I don't know why it is wrong, the error in the console is: "syntax error at or near "SELECT" LINE 5: SELECT public.dblink_connect('hostaddr=127.0.0.1 port=54... I'm using the version 9.3.6 on Ubuntu. CREATE OR REPLACE FUNCTION fn_replicate_insertof_students() RETURNS text AS $BODY$ BEGIN SELECT public.dblink_connect('hostaddr=127.0.0.1 port=5433 dbname=Utiles user=postgres password=Mypass'); INSERT INTO

postgresql: INSERT INTO … (SELECT * …)

北慕城南 提交于 2019-12-11 14:49:51
问题 I'm not sure if its standard SQL: INSERT INTO tblA (SELECT id, time FROM tblB WHERE time > 1000) What I'm looking for is: what if tblA and tblB are in different DB Servers . Does PostgreSql gives any utility or has any functionality that will help to use INSERT query with PGresult struct I mean SELECT id, time FROM tblB ... will return a PGresult* on using PQexec . Is it possible to use this struct in another PQexec to execute an INSERT command. EDIT: If not possible then I would go for

synchronizing two tables in postgres using DBlink

假装没事ソ 提交于 2019-12-11 08:34:36
问题 I want to have two synchronized DB in two different servers (server1 and server2) so: table1 in server1 updates table1 in server2 when table1 in server1 changes and table1 in server2 updates table1 in server1 when table1 in server2 changes this way i can have both tables synchronized when updated from both server, i have managed to use DBlink without problems to update from server1 to server 2. What is the problem? when both tables have triggers enabled it creates an infinite loop so server1

Trigger to insert rows in remote database after deletion

允我心安 提交于 2019-12-11 02:36:41
问题 I have created a trigger that works like this: After deleting data from table flux_tresorerie_historique it insert this row in the table flux_tresorerie_historique that is located in another database archive I use dblink to insert data in the remote database, the problem is that the creation of the query is too hard especially that the table contain more than 20 columns, and I want to create similar functions for 10 other tables. Is there another rapid way to ensure this task? Here an example

Postgresql: dblink in Stored Functions

為{幸葍}努か 提交于 2019-12-11 00:03:46
问题 I want to insert top 20 ROWS from a table tbl_A in db_A to tbl_B in db_B. The schema for tbl_A and tbl_B is: CREATE TABLE <tbl_name> ( id serial PRIMARY KEY, int a, int b ); I have some questions related to following queries psql db_A SELECT dblink_connect("dbname=db_B"); SELECT dblink_open('curse', 'SELECT id, a, b FROM tbl_B'); INSERT INTO tbl_A (SELECT id, a, b FROM dblink_fetch('curse', 20) AS (s_is int, s_a int, s_b int)) RETURNING a; Can I put the following statements in stored

Is it possible to connect to DB in Oracle APEX application externally?

我怕爱的太早我们不能终老 提交于 2019-12-10 20:08:14
问题 I am trying to query the table stored in Oracle APEX application externally (using Java). But, i am quite not sure on achieving it. Because, inside APEX i was able to access external databases using dblink. But, the other way around is puzzling me. It starts from what should be the connect string, will there be host & port details etc.,. Search on oracle docs and other dba forums didn't cover this scenario. It would be a great help if someone can give a pointer on this. 回答1: According to the