cancel
Showing results for 
Search instead for 
Did you mean: 

When will SQLA reuse the connection id

MCMartin
Participant
3,122

What is the strategy of SQLA to reuse a connection id?

Accepted Solutions (1)

Accepted Solutions (1)

Breck_Carter
Participant

AFAIK unique connection numbers are assigned for all connections to all databases started by one server execution instance, and they can be reused only by a different execution instance. Presumably, they can also be reused if the number wraps.

If you're keeping records: For a given database file, CONNECTION_PROPERTY ( 'Number' ) and CONNECTION_PROPERTY ( 'LoginTime' ) suffice to uniquely idenfify a connection.

MCMartin
Participant

Answers (1)

Answers (1)

VolkerBarth
Contributor

Just to add a quote from the v9.0.1 (and 8.0.3) "What's new" section:

Connection IDs start at 1 and are incremented for each new connection to the database server

When the database server is started, each connection to the server is assigned a connection ID, starting with 1, and the connection number is incremented with each new connection to the server. The connection IDs are logged in the -z server output and the LogFile connection parameter output. They are also used by the CONNECTION_PROPERTY, NEXT_CONNECTION, NEXT_DATABASE, and DROP CONNECTION functions, and by request logging.

(Internal/temporary connections used by events and the like are treated differently, as you'll know.)

For older versions, the behaviour was different, but I don't remember...