libpq equivalent of jdbc:default:connection

Started by Jim McLaughlinover 11 years ago3 messagesgeneral
Jump to latest
#1Jim McLaughlin
jomclaughlin@gmail.com

Hi all,

I am rewriting a pljava procedure in C++ with libpq. This procedure needs
to access some temp tables that the calling procedure creates and
populates. It seems that the connection created by PQconnectdb creates a
new connection (I have tried all permutations of conninfo I could think
of). Since the connection is new, the temp tables are not available
obviously. On the pljava side, we simply created a connection with
DriverManager.getConnection("jdbc:default:connection"), which behaved
admirably. Is there a way to accomplish similar behavior with libpq?

Best,
Jim

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Jim McLaughlin (#1)
Re: libpq equivalent of jdbc:default:connection

Jim McLaughlin wrote

Hi all,

I am rewriting a pljava procedure in C++ with libpq. This procedure needs
to access some temp tables that the calling procedure creates and
populates. It seems that the connection created by PQconnectdb creates a
new connection (I have tried all permutations of conninfo I could think
of). Since the connection is new, the temp tables are not available
obviously. On the pljava side, we simply created a connection with
DriverManager.getConnection("jdbc:default:connection"), which behaved
admirably. Is there a way to accomplish similar behavior with libpq?

Best,
Jim

I suspect you want this:

http://www.postgresql.org/docs/9.3/interactive/spi-spi-connect.html

but I've never used c++

David J.

--
View this message in context: http://postgresql.nabble.com/libpq-equivalent-of-jdbc-default-connection-tp5830106p5830110.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Jim McLaughlin
jomclaughlin@gmail.com
In reply to: David G. Johnston (#2)
Re: libpq equivalent of jdbc:default:connection

Thanks David! This is what I needed. I figured I was looking in the wrong
place.

On Thu, Dec 11, 2014 at 10:58 AM, David G Johnston <
david.g.johnston@gmail.com> wrote:

Show quoted text

Jim McLaughlin wrote

Hi all,

I am rewriting a pljava procedure in C++ with libpq. This procedure needs
to access some temp tables that the calling procedure creates and
populates. It seems that the connection created by PQconnectdb creates a
new connection (I have tried all permutations of conninfo I could think
of). Since the connection is new, the temp tables are not available
obviously. On the pljava side, we simply created a connection with
DriverManager.getConnection("jdbc:default:connection"), which behaved
admirably. Is there a way to accomplish similar behavior with libpq?

Best,
Jim

I suspect you want this:

http://www.postgresql.org/docs/9.3/interactive/spi-spi-connect.html

but I've never used c++

David J.

--
View this message in context:
http://postgresql.nabble.com/libpq-equivalent-of-jdbc-default-connection-tp5830106p5830110.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general