Getting connection properties without login

624
2
Jump to solution
11-09-2017 05:43 AM
FabianPfromm
New Contributor

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.

0 Kudos
1 Solution

Accepted Solutions
ColinZwicker
Esri Contributor

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

View solution in original post

0 Kudos
2 Replies
ColinZwicker
Esri Contributor

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

0 Kudos
ColinZwicker
Esri Contributor

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

0 Kudos