Each session should have a db connection. Store db in the Session object.
I do not understand, is logic one connection for all users, CGI Application or Standalone running all time,not share connection DB for all?
Multiple users (i.e. sessions) will be accessing the database at the same time. If you use one global connection they will either block each other, or step on each other (i.e. user A seeing error info for a query performed by user B).
If you have a separate connection for each session you let the database manage concurrency issues, which is what databases like Postgres and MySQL are designed to do and do well. You also insure that operations by one user will not alter connection state for another user.