Skip to content

Instantly share code, notes, and snippets.

@jtroe
Created March 14, 2024 21:58
Show Gist options
  • Save jtroe/dfad2144f8accbb200755244315bb13e to your computer and use it in GitHub Desktop.
Save jtroe/dfad2144f8accbb200755244315bb13e to your computer and use it in GitHub Desktop.
portal = arcgis.GIS(profile='my_portal')
server = portal.admin.servers.list()[0]
svc = server.services.list(folder='Hosted')[0]
datastore_name = svc.properties.jsonProperties.adminServiceInfo.database.datasource.name
datastore = server.datastores.list()[0] # instead search by datastore_name
# if it's a database
jdbc_server = datastore.properties.info.JDBCConnection.url
jdbc_username = datastore.properties.info.JDBCConnection.username
# datastore.properties.info.filePath if it's not a database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment