I have a database connection file and want to get its connection properties.
The problem is that the connection properties do not include a valid username and password and I want to avoid the standard login popup to appear.
Is there any way of getting the properties, so I can add username and password from code and connect with that data?
The ultimate goal is to make my own custom login popup, so basically I want to get the properties, then add username and password from my own login window and then connect to the database.
Solved! Go to Solution.
Fabian,
We added a GetDatabaseConnectionProperties function in the DatabaseClient class for the ArcGIS Pro 2.1 release.
DatabaseConnectionFile connectionFile = new DatabaseConnectionFile(new Uri(@"C:\my.sde"));
DatabaseConnectionProperties expectedConnectionProperties = DatabaseClient.GetDatabaseConnectionProperties(connectionFile);
This will allow you to modify (assign a user password etc) the connection properties before using them to open a new Geodatabase. By having it available on the DatabaseClient it can be used for connections files that point to Geodatabases or DBMS's without the Geodatabase metadata.
Happy connecting!
Colin
Fabian,
This is a current limitation of the api, and will be addressed in the next release.
The result will be a pattern to generate a DatabaseConnectionProperties directly from a DatabaseConnecitonFile without requiring that the Geodatabase is opened.
Thank you for your question!
Colin
Fabian,
We added a GetDatabaseConnectionProperties function in the DatabaseClient class for the ArcGIS Pro 2.1 release.
DatabaseConnectionFile connectionFile = new DatabaseConnectionFile(new Uri(@"C:\my.sde"));
DatabaseConnectionProperties expectedConnectionProperties = DatabaseClient.GetDatabaseConnectionProperties(connectionFile);
This will allow you to modify (assign a user password etc) the connection properties before using them to open a new Geodatabase. By having it available on the DatabaseClient it can be used for connections files that point to Geodatabases or DBMS's without the Geodatabase metadata.
Happy connecting!
Colin