0

I have access to two databases, each with a separate connection. The first connection is an .sde connection to a SDE 10.3.1 Oracle database, and the second connection is a .odc OLE DB connection to a third party software Oracle database. Is it possible to use both databases/connections in a query layer? I have some fairly complex non-spatial SQL queries I'd like to do using both databases; the SQL includes subqueries, group by, etc.

My guess is that the answer is no; it looks like you can only select one connection when creating a query layer. I've worked through a few alternatives, but they all seem to be lacking in one way or another:

  1. Create a query layer on a table from a single connection/database, then create an in-map join to a table from the other database/connection using the layer properties in ArcMap. This is better than nothing, but is severely limited. I can't do any of the SQL querying that I need to do such as subqueries, group by, etc.

  2. Use the Make Query Table geoprocessing tool, which sems to be able to reference multiple connections/databases. This has similar limitations to #1. You can enter an expression, but I believe the expression is the equivalent to the WHERE clause in SQL, which is limited. I can't do subqueries, group by, etc. here either.

  3. I don't believe it's possible to create a view in one database that would reference another database.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 2, 2016 at 13:55

2 Answers 2

1

Create an SDE schema in the database that holds the attribute data.

Grant connect to that SDE user on the attribute table that you want ArcGIS to see.

Mount the new SDE instance in ArcMap, it will contain the attribute table you want to join to your spatial table.

Use the standard join command between your spatial and attribute table.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
answered Sep 14, 2017 at 6:17
1
  • 1
    Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. Commented Sep 14, 2017 at 6:28
0

You may want to look at dblinks. They make it possible to access a table in a remote database just as if it was local. You can then write queries that join tables from multiple databases. The query optimizer will automatically distribute the work appropriately to the various databases - like push a join between two remote tables coming from the same database, to that database. And of course you can then also create a view over that join, making the process transparent to applications.

See https://docs.oracle.com/database/121/ADMIN/ds_concepts.htm#ADMIN028 for details (follow "Database Links") for an overview.

answered Aug 3, 2016 at 7:22
1
  • This is exactly the solution I needed. Thanks Albert. Commented Sep 7, 2016 at 20:30

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.