Decicision needed for connect statement

Started by Michael Meskesabout 28 years ago15 messageshackers
Jump to latest
#1Michael Meskes
meskes@postgresql.org

The say the connect statement has to have the following form:

CONNECT TO <SQL-server> [AS <connection name>] [USER <user name>]

It is implementation dependant how to get database name, server name resp.
number and port number from SQL-server. How will we do this?

How about this?

<dbname>@<server>:<port>

Each missing entry will be set to the default value:
template1@localhost:5432.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#2Michael Meskes
meskes@postgresql.org
In reply to: Michael Meskes (#1)
Re: [HACKERS] Decicision needed for connect statement

Thomas G. Lockhart writes:

Each missing entry will be set to the default value:
template1@localhost:5432.

Looks good, though perhaps the default db should be the user's name?

Yes, of course. This example came just from me using the Debian release of
6.3 which opens template1 as default. I cannot run 6.4, so I have to test
with the old version.

I do not enter a default myself, but rather let PQsetdb handle it.

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

That looks good. But to be really usefule I think we should add both ways
not only to ecpg, but to psql as well.

How about a adding the parser code for both to PQsetdb so we can do:

PQsetdeb(NULL,NULL,NULL,NULL,"postgres://server:port/dbname")

and

PQsetdeb(NULL,NULL,NULL,NULL,"dbname@server:port")

as synonym for

PQsetdb(server,port,NULL,NULL,dbname)?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#3Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Michael Meskes (#1)
Re: [HACKERS] Decicision needed for connect statement

CONNECT TO <SQL-server> [AS <connection name>] [USER <user name>]
How about this?
<dbname>@<server>:<port>
Each missing entry will be set to the default value:
template1@localhost:5432.

Looks good, though perhaps the default db should be the user's name?

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

- Tom

#4Michael Meskes
meskes@postgresql.org
In reply to: Thomas Lockhart (#3)
RE: [HACKERS] Decicision needed for connect statement

Great. Do we implement this in libpq?

And do we implement the old style syntax with '@', too?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 3:27 PM
To: 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc
my
home address.

#5Peter T Mount
peter@retep.org.uk
In reply to: Michael Meskes (#4)
RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc my
home address.

#6Andreas Zeugswetter
andreas.zeugswetter@telecom.at
In reply to: Peter T Mount (#5)
Re: [HACKERS] Decicision needed for connect statement

The : is used in Informix as the delimiter to a remote tablename like:
dns@dns1ifx:dnstab
but I like the look of your dbname syntax.

I think it might still be a good Idea to start using a connection file like
Informix (sqlhosts) and Oracle (tnsnames.ora) use it, so we could have short names
for our Instances and a flexible way to add additional config options in this file.

Informix has:
# shortname protocol hostname service additional
zeusifx onsoctcp zeus sqlexec
zeusifxshm onipcshm zeus zeusifxshm
zvrentifx onsoctcp a1880104 sqlexec7

Therefore:
connect to dbname@shortname

Andreas

The say the connect statement has to have the following form:

CONNECT TO <SQL-server> [AS <connection name>] [USER <user name>]

It is implementation dependant how to get database name, server name resp.
number and port number from SQL-server. How will we do this?

How about this?

<dbname>@<server>:<port>

Each missing entry will be set to the default value:
template1@localhost:5432.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#7Peter T Mount
peter@retep.org.uk
In reply to: Andreas Zeugswetter (#6)
RE: [HACKERS] Decicision needed for connect statement

I'm not sure about libpq as I've never used either with it. However,
URL-style does seem to be the in thing at the moment.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc my
home address.

-----Original Message-----
From: Meskes, Michael [mailto:meskes@topsystem.de]
Sent: Thursday, May 07, 1998 2:42 PM
To: 'Peter Mount'; 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Great. Do we implement this in libpq?

And do we implement the old style syntax with '@', too?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 3:27 PM
To: 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc
my
home address.

#8Jackson, DeJuan
djackson@cpsgroup.com
In reply to: Peter T Mount (#7)
RE: [HACKERS] Decicision needed for connect statement

CONNECT TO <SQL-server> [AS <connection name>] [USER <user name>]

What about PASSWORD?
-DEJ

#9Phil Thompson
phil@river-bank.demon.co.uk
In reply to: Michael Meskes (#1)
Re: [HACKERS] Decicision needed for connect statement

Michael Meskes wrote:

The say the connect statement has to have the following form:

CONNECT TO <SQL-server> [AS <connection name>] [USER <user name>]

It is implementation dependant how to get database name, server name resp.
number and port number from SQL-server. How will we do this?

I use <server>:<port> as <SQL-server> and a separate SET SCHEMA <name>
to set the database name as (I think) this is more consistent with
SQL/2.

Phil

#10Michael Meskes
meskes@postgresql.org
In reply to: Phil Thompson (#9)
RE: [HACKERS] Decicision needed for connect statement

Okay, I'm willing to add it to either libecpg or (preferable imn my
mind) to libpq. I'd also like to add my (old style) syntax if no one
objects.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 5:23 PM
To: 'Meskes, Michael'; 'Peter Mount'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

I'm not sure about libpq as I've never used either with it. However,
URL-style does seem to be the in thing at the moment.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc
my
home address.

-----Original Message-----
From: Meskes, Michael [mailto:meskes@topsystem.de]
Sent: Thursday, May 07, 1998 2:42 PM
To: 'Peter Mount'; 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Great. Do we implement this in libpq?

And do we implement the old style syntax with '@', too?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 3:27 PM
To: 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please

cc

my
home address.

#11Michael Meskes
meskes@postgresql.org
In reply to: Phil Thompson (#9)
Re: [HACKERS] Decicision needed for connect statement

Phil Thompson writes:

I use <server>:<port> as <SQL-server> and a separate SET SCHEMA <name>
to set the database name as (I think) this is more consistent with
SQL/2.

I don't think I like this:

12.3 <set schema statement>

Function

Set the default schema name for unqualified <schema qualified
name>s in <preparable statement>s that are prepared in the
current SQL-session by an <execute immediate statement> or a
<prepare statement> and in <direct SQL statement>s that are invoked
directly.

...

So it means I have to do the following to really connect:

exec sql connect to server;
exec sql set scheme template1;

This only makes sense IMO if we support different schemes over one
connection. but we don't do this, do we?

Michael
--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#12Michael Meskes
meskes@postgresql.org
In reply to: Jackson, DeJuan (#8)
Re: [HACKERS] Decicision needed for connect statement

Jackson, DeJuan writes:

CONNECT TO <SQL-server> [AS <connection name>] [USER <user name>]

What about PASSWORD?
-DEJ

It's simply not listed. Oracle allows two was:

1) List the username as <user>/<passwd>
2) Add the clause 'IDENTIFIED BY <passwd>'.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#13Peter T Mount
peter@retep.org.uk
In reply to: Michael Meskes (#12)
RE: [HACKERS] Decicision needed for connect statement

[resent as the local mail system screwed up - 10 points to guess what system
it is ;-) ]

Okay, I'm willing to add it to either libecpg or (preferable imn my
mind) to libpq. I'd also like to add my (old style) syntax if no one
objects.

I don't see why not. Handling both won't expand libpq by that much.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc my
home address.

Show quoted text

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 5:23 PM
To: 'Meskes, Michael'; 'Peter Mount'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

I'm not sure about libpq as I've never used either with it. However,
URL-style does seem to be the in thing at the moment.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc
my
home address.

-----Original Message-----
From: Meskes, Michael [mailto:meskes@topsystem.de]
Sent: Thursday, May 07, 1998 2:42 PM
To: 'Peter Mount'; 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Great. Do we implement this in libpq?

And do we implement the old style syntax with '@', too?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 3:27 PM
To: 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please

cc

my
home address.

#14Michael Meskes
meskes@postgresql.org
In reply to: Peter T Mount (#13)
RE: [HACKERS] Decicision needed for connect statement

Let me try. Hmm, something from Microsoft? :-)

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Friday, May 08, 1998 10:44 AM
To: 'Meskes, Michael'; 'Peter Mount'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

[resent as the local mail system screwed up - 10 points to guess what
system
it is ;-) ]

Okay, I'm willing to add it to either libecpg or (preferable imn my
mind) to libpq. I'd also like to add my (old style) syntax if no one
objects.

I don't see why not. Handling both won't expand libpq by that much.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc
my
home address.

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 5:23 PM
To: 'Meskes, Michael'; 'Peter Mount'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

I'm not sure about libpq as I've never used either with it. However,
URL-style does seem to be the in thing at the moment.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please

cc

my
home address.

-----Original Message-----
From: Meskes, Michael [mailto:meskes@topsystem.de]
Sent: Thursday, May 07, 1998 2:42 PM
To: 'Peter Mount'; 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Great. Do we implement this in libpq?

And do we implement the old style syntax with '@', too?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr.

20

meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 3:27 PM
To: 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please

cc

my
home address.

#15Peter T Mount
peter@retep.org.uk
In reply to: Michael Meskes (#14)
RE: [HACKERS] Decicision needed for connect statement

Bingo, you got it in one.

There are only two businesses who call their customers 'users'

-----Original Message-----
From: Meskes, Michael [mailto:meskes@topsystem.de]
Sent: Friday, May 08, 1998 10:26 AM
To: 'Peter Mount'; 'Meskes, Michael'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Let me try. Hmm, something from Microsoft? :-)

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Friday, May 08, 1998 10:44 AM
To: 'Meskes, Michael'; 'Peter Mount'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

[resent as the local mail system screwed up - 10 points to guess what
system
it is ;-) ]

Okay, I'm willing to add it to either libecpg or (preferable imn my
mind) to libpq. I'd also like to add my (old style) syntax if no one
objects.

I don't see why not. Handling both won't expand libpq by that much.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please cc
my
home address.

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 5:23 PM
To: 'Meskes, Michael'; 'Peter Mount'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

I'm not sure about libpq as I've never used either with it. However,
URL-style does seem to be the in thing at the moment.

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please

cc

my
home address.

-----Original Message-----
From: Meskes, Michael [mailto:meskes@topsystem.de]
Sent: Thursday, May 07, 1998 2:42 PM
To: 'Peter Mount'; 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Great. Do we implement this in libpq?

And do we implement the old style syntax with '@', too?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr.

20

meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

-----Original Message-----
From: Peter Mount [SMTP:peter@maidstone.gov.uk]
Sent: Thursday, May 07, 1998 3:27 PM
To: 'Michael Meskes'; 'Thomas G. Lockhart'
Cc: 'PostgreSQL Hacker'
Subject: RE: [HACKERS] Decicision needed for connect statement

Is there any benefit to using a url-style spec?

postgres://server:port/dbname

Very fashionable :)

This would be in line to JDBC's url-style:

jdbc:postgresql://server:port/dbname?options

--
Peter T Mount, peter@maidstone.gov.uk, peter@retep.org.uk
Please note that this is from my works email. If you reply, please

cc

my
home address.