Backend Protocol Examples?

Lists: pgsql-jdbc
From: groups(at)ezotyrik(dot)org (Ezotyrik)
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Backend Protocol Examples?
Date: 2003-12-01 03:48:12
Message-ID: 3b4102b7.0311301948.59eae584@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

I tried to do execute the following, but each time the program hangs
waiting on the ReceiveString. Also, the new postgres process started
to handle the query has a really high CPU % as reported by top.

I'd love to see simple examples of conversing with the backend. Also,
is there a nice summary of the protocol that offers more nitty-gritty
than the standard FE/BE discussion in the 7.4 docs?

Thanks!

synchronized( pg_stream ) {
try {
pg_stream.SendChar('Q');
pg_stream.Send( c.getEncoding().encode( "BEGIN" ));
pg_stream.SendChar(0);
pg_stream.flush();

System.out.println("step1");
str = pg_stream.ReceiveString( c.getEncoding() );
System.out.println("step2");


From: groups(at)ezotyrik(dot)org (Ezotyrik)
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Backend Protocol Examples?
Date: 2003-12-05 03:15:12
Message-ID: 3b4102b7.0312041915.1f576099@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Guess my next question is does anyone know of a more appropriate place
to ask this question?

I know some work was done on creating a COPY api -- hopefully that
code makes it into a future JDBC release, and I can study that.

groups(at)ezotyrik(dot)org (Ezotyrik) wrote in message news:<3b4102b7(dot)0311301948(dot)59eae584(at)posting(dot)google(dot)com>...
> I tried to do execute the following, but each time the program hangs
> waiting on the ReceiveString. Also, the new postgres process started
> to handle the query has a really high CPU % as reported by top.
>
> I'd love to see simple examples of conversing with the backend. Also,
> is there a nice summary of the protocol that offers more nitty-gritty
> than the standard FE/BE discussion in the 7.4 docs?
>
> Thanks!
>
> synchronized( pg_stream ) {
> try {
> pg_stream.SendChar('Q');
> pg_stream.Send( c.getEncoding().encode( "BEGIN" ));
> pg_stream.SendChar(0);
> pg_stream.flush();
>
> System.out.println("step1");
> str = pg_stream.ReceiveString( c.getEncoding() );
> System.out.println("step2");


From: Kris Jurka <books(at)ejurka(dot)com>
To: Ezotyrik <groups(at)ezotyrik(dot)org>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Backend Protocol Examples?
Date: 2003-12-10 00:18:51
Message-ID: Pine.LNX.4.33.0312091910290.18364-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On 4 Dec 2003, Ezotyrik wrote:

> Guess my next question is does anyone know of a more appropriate place
> to ask this question?

If your question is just about the fe/be protocol than -hackers is
probably a better place to ask, but if it's about java than here is
correct. I read your original message, but wasn't inspired to reply
because I had no idea what you were trying to do. Why are you trying to
directly communicate with the server?

I would start by looking at org.postgresql.core.QueryExecutor's
sendQueryV3 and sendQueryV2 methods. You seem to be using the V2 method
(no message length). Could that be the problem?

Kris Jurka


From: groups(at)ezotyrik(dot)org (Ezotyrik)
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Backend Protocol Examples?
Date: 2003-12-24 03:52:59
Message-ID: 3b4102b7.0312231952.2752d08a@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Thanks for the direction.

What am I trying to do? I wanted to send a COPY command directly to
the backend. COPY implemented as an input stream, would be fast, and
allow easy monitoring of % complete.

books(at)ejurka(dot)com (Kris Jurka) wrote in message news:<Pine(dot)LNX(dot)4(dot)33(dot)0312091910290(dot)18364-100000(at)leary(dot)csoft(dot)net>...
> On 4 Dec 2003, Ezotyrik wrote:
>
> > Guess my next question is does anyone know of a more appropriate place
> > to ask this question?
>
> If your question is just about the fe/be protocol than -hackers is
> probably a better place to ask, but if it's about java than here is
> correct. I read your original message, but wasn't inspired to reply
> because I had no idea what you were trying to do. Why are you trying to
> directly communicate with the server?
>
> I would start by looking at org.postgresql.core.QueryExecutor's
> sendQueryV3 and sendQueryV2 methods. You seem to be using the V2 method
> (no message length). Could that be the problem?
>
> Kris Jurka
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html