diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml index cdc4761c60..5bc8ca1faa 100644 --- a/doc/src/sgml/ecpg.sgml +++ b/doc/src/sgml/ecpg.sgml @@ -222,10 +222,15 @@ EXEC SQL CONNECT TO target AS The connection-name is used to handle multiple connections in one program. It can be omitted if a - program uses only one connection. The most recently opened - connection becomes the current connection, which is used by default - when an SQL statement is to be executed (see later in this - chapter). + program uses only one connection. + + + + The most recently opened connection becomes the current connection. + The current connection is managed in a per-thread manner. For the + first use on a thread, it is the most recently opened one in the + process. The current connection is used by default when an SQL + statement is to be executed (see later in this chapter). @@ -276,8 +281,8 @@ EXEC SQL CONNECT TO :target USER :user USING :passwd; SQL statements in embedded SQL programs are by default executed on - the current connection, that is, the most recently opened one. If - an application needs to manage multiple connections, then there are + the current connection, that is, the most recently opened one in each thread. + If an application needs to manage multiple connections, then there are three ways to handle this. @@ -439,6 +444,13 @@ EXEC SQL DISCONNECT connection; It is good style that an application always explicitly disconnect from every connection it opened. + + + + Connections are shared among all threads. Be careful not to + disconnect a connection that is to be used in another thread. + +