java - How to Test a Database connection with spid? -


if have username, password , jdbc connection url. test db connection using:-

drivermanager.getconnection(connectionurl,username,password); 

but, in case have jdbc url , pksd. how test db url , spid in java?

here pksd kind of certificate authentication.

it depends on see 'testing database'. want check if server responds incoming connections? can test using jdbc url. open connection (maybe random username/password combination) , see if server responds 'access denied' error or something. if timeout or other connection error, went wrong.

if want execute specific query , result of query important test (so query has executed properly), way can test when know username/password can log in sql server , thing. option enable anonymous access database (possibly limited privileges), should think twice before doing this.

also, doing fallback possible:

drivermanager.getconnection(connectionurl); 

Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -