Thread: API like mysql_ping
<div class="Section1"><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">Do we have an API like mysql_ping to check whether the server is up and running after the connection hasbeen established?</span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><font face="Arial" size="2"><span style="font-size:10.0pt; font-family:Arial">I checked the PostgreSQL docs but of no use.</span></font><p class="MsoNormal"><font face="Arial" size="2"><spanstyle="font-size:10.0pt; font-family:Arial">Is there any work around for this?</span></font><p class="MsoNormal"><font face="Arial" size="2"><spanstyle="font-size:10.0pt; font-family:Arial"> </span></font><p class="MsoNormal"><em><b><i><font face="Times New Roman" size="2"><span style="font-size:10.0pt;font-weight:bold">Regards,</span></font></i></b></em><pclass="MsoNormal"><em><b><i><font face="TimesNew Roman" size="2"><span style="font-size:10.0pt;font-weight:bold">Siva Kumar.K</span></font></i></b></em><pclass="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12.0pt"> </span></font></div>
PQstatus perhaps? http://www.postgresql.org/docs/8.0/interactive/libpq-status.html Chris Sivakumar K wrote: > > > Do we have an API like mysql_ping to check whether the server is up and > running after the connection has been established? > > > > I checked the PostgreSQL docs but of no use. > > Is there any work around for this? > > > > /*/ Regards, /*/ > > /*/ Siva Kumar.K /*/ > > >
Christopher Kings-Lynne wrote: > PQstatus perhaps? > > http://www.postgresql.org/docs/8.0/interactive/libpq-status.html This only returns the last status, not the current. pgAdmin uses SELECT 1 for this. Regards, Andreas
Sivakumar K wrote: > Do we have an API like mysql_ping to check whether the server is up and > running after the connection has been established? At the protocol level, you could send Sync and wait for ReadyForQuery. -O
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >> PQstatus perhaps? >> >> http://www.postgresql.org/docs/8.0/interactive/libpq-status.html > This only returns the last status, not the current. > pgAdmin uses SELECT 1 for this. Better still: PQtransactionStatus, followed by a quick PQexec of "SELECT 'pingtest' if it returns PQTRANS_IDLE. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200508250940 https://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAkMNymsACgkQvJuQZxSWSsjm2gCgt+4pdyd5GiFjyJeDqNSbR14C svMAn0OxrtEqcFgDruogLdmhvavokdSb =nist -----END PGP SIGNATURE-----
Oliver Jowett <oliver@opencloud.com> writes: > Sivakumar K wrote: >> Do we have an API like mysql_ping to check whether the server is up and >> running after the connection has been established? > At the protocol level, you could send Sync and wait for ReadyForQuery. At the client level, the easiest thing is probably to execute an empty query string. regards, tom lane