Connect to SQL Server Database dynbamically

2901
2
02-15-2013 10:23 AM
Labels (1)
jp
by
New Contributor II
Hi,

I am developing a Runtime application that enables user selected Access or SQL database to connect. According to the concepts page this is possible through datasource or querydatasource but only through the workspaceID from a ArcGISDynamicMapServiceLayer. 
I was able to open Access database from a custom python script tool. Is this possible to do the same with SQL database?
I cannot use CreateDatabaseConnectoin tool because its not supported in ArcGIS Runtime. Another way is using 'pyodbc' library.

Has anybody else ideas or experience with this kind of workflow?

Thanks!
0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Are these Access / SQL Server databases actually Geodatabases? Or would you like to join a non-spatial table from the database to a spatial dataset in another datasource? I'm assuming it's the latter... you could take a look at this earlier post which discusses using the JoinDataSource: http://forums.arcgis.com/threads/74686-Joining-Database-with-Map-Layer?

Cheers

Mike
0 Kudos
jp
by
New Contributor II
Thanks Mike!

I looked at the posting you referred to but I found ArcGIS Runtime doesn't support workspacefactorytype of SQL Server database. So this might not work as desired.
I can think of only looping through the data and editing the a default table everytime the application is connected to a new database. Since its not possible to connect to SQL server in ArcGIS Runtime. Actually I need to attach a mdf file to SQL Server.

Is there another way?

Thanks!


Hi,

Are these Access / SQL Server databases actually Geodatabases? Or would you like to join a non-spatial table from the database to a spatial dataset in another datasource? I'm assuming it's the latter... you could take a look at this earlier post which discusses using the JoinDataSource: http://forums.arcgis.com/threads/74686-Joining-Database-with-Map-Layer?

Cheers

Mike
0 Kudos