Select to view content in your preferred language

Setting up an OLE DB Conection in modelbuilder.

1116
6
07-02-2018 01:15 PM
BenjaminMittler
Occasional Contributor III

I'm in the process of creating a tool in modelbuilder that pulls data from a table through an OLE DB connection and then uses it for further analysis. The model works on my computer but I plan on rolling the tool out to other staff members. I forsee a problem where other staff will go to use the tool but be unable to run it due to not having previously set up the OLE DB connection (they have access to the data server but dont have an OLE DB connection set up).

I'm trying to add a step to my model that checks for the OLE DB connection and then makes the connection if doesnt already exist. I cant seem to figure out how to do this. Any advice?

Thanks

0 Kudos
6 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Benjamin,

What type of database (i.e. SQL Server) are you making an OLE DB Connection to?

0 Kudos
BenjaminMittler
Occasional Contributor III

SQL Server

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Instead of using an OLE DB Connection, you can create an ArcSDE Connection File, even if your SQL Server instance is not a geodatabase.  Your script could include the arcpy.CreateArcSDEConnectionFile_management function:

Create ArcSDE Connection File—Help | ArcGIS Desktop 

BenjaminMittler
Occasional Contributor III

Thanks,

I was able to establish the ArcSDE Connection File. From my understanding this is a regular server connection and not an OLE DB Connection. I'm not a database expert (although I'm thinking of taking some DB classes), but the reason I was trying to establish an OLE DB connection is because I read it was Read-Only and users wouldn't be able to edit any tables.

Is there a way to develop an ArcSDE Connection File that is read only? The database i'm connection to houses a lot of data and I don't want any chance of users being able to edit or delete anything.

0 Kudos
MichaelVolz
Esteemed Contributor

You would use roles assigned to a user that would control whether the data is only read-only (Just provide select privileges).

TedKowal
Regular Contributor II

I used arc catalog connection with the connection string file on a network drive , still have to make sure all users are using that ...and in my model I am connecting to that....... however you may gain some inspiration towards a solution here:  

arcpy - Create an ArcCatalog OLE DB Connection using Python - Geographic Information Systems Stack E... 

0 Kudos