cancel
Showing results for 
Search instead for 
Did you mean: 

ConnectFailed event

markmumy
Product and Topic Expert
Product and Topic Expert
2,489

I want to create an event that logs info for any failed connection. I am trying to use the ConnectFailed event type, but that doesn't seem to fire for all failed conditions. In particular, if I have an inbound connection that fails because "Database server connection limit exceeded", I want to capture that as well as other information about the server. My event looks something like this:

create event connect_fail_event type "ConnectFailed" handler begin message 'ConnectFailed event fired at '||getdate() to console; end ;

If I put in an incorrect user/password then it fires. But if I exceed the number of allows connections, it doesn't fire.

Thoughts?

VolkerBarth
Contributor
0 Kudos

I'd usually also log the according event parameters like AppInfo, User and SQLCODE via the EVENT_PARAMETER() function. For the connection limit, I had expected SQLCODE -102 (SQLE_TOO_MANY_CONNECTIONS).

markmumy
Product and Topic Expert
Product and Topic Expert
0 Kudos

Oh, absolutely. That's my plan. However, I can't get the event to fire when we've exceeded too many connections. Capturing any other data is pointless, since there's no event run to do the capture.

Breck_Carter
Participant
0 Kudos

Here's a WAG: try using a login_procedure to capture information about the failed connection.

Accepted Solutions (0)

Answers (1)

Answers (1)

chinmaydixit
Explorer
0 Kudos

An event of type ConnectFailed would never fire on "Database server connection limit exceeded" as the connection object has not been initialized yet.

VolkerBarth
Contributor
0 Kudos

So is that insider knowledge?

(Just because I would expect such technical statements primarily from SQL Anywhere team members...)

chinmaydixit
Explorer
0 Kudos

I noticed this behavior few years ago in SA16 and did not see a connection id in All Connections in Sybase Central, but yes you are right, SA team members can confirm this.

VolkerBarth
Contributor

So would you see an otherwise failing connection there, say one faling because of wrong credentials?

chinmaydixit
Explorer
0 Kudos

Correct. Wrong credentials doesn't show up either but syntax errors does.

jack_schueler
Product and Topic Expert
Product and Topic Expert

Perhaps the server properties MaxConnections and ConnCount could be used in some way. I assume that if ConnCount == MaxConnections then the next connection attempt would fail. At least you'd know that you've reached the max. Not quite as good as knowing that a connection attempt failed because you have reached the max.