<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Creating SDE database connection properties file"</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CreateDatabaseConnection_management<SPAN class="punctuation token">(</SPAN>out_folder_path<SPAN class="operator token">=</SPAN>os<SPAN class="punctuation token">.</SPAN>getcwd<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> out_name<SPAN class="operator token">=</SPAN>Connection_File_Name<SPAN class="punctuation token">,</SPAN> database_platform<SPAN class="operator token">=</SPAN>database_type<SPAN class="punctuation token">,</SPAN> instance<SPAN class="operator token">=</SPAN>instance<SPAN class="punctuation token">,</SPAN> database<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> account_authentication<SPAN class="operator token">=</SPAN><SPAN class="string token">"DATABASE_AUTH"</SPAN><SPAN class="punctuation token">,</SPAN> username<SPAN class="operator token">=</SPAN>dbms_admin<SPAN class="punctuation token">,</SPAN> password<SPAN class="operator token">=</SPAN>dbms_admin_pwd<SPAN class="punctuation token">,</SPAN> save_user_pass<SPAN class="operator token">=</SPAN><SPAN class="string token">"TRUE"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">if</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Exists<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Database Connections\\"</SPAN> <SPAN class="operator token">+</SPAN> Connection_File_Name<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Current SDE connection was created and database connection successful"</SPAN>
sys<SPAN class="punctuation token">.</SPAN>exit<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token"># Don't hard exit on failure. If creating a "system" sde file arcpy exist does not work correctly.</SPAN>
<SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Unable to validate connection to SDE database. There could be a problem with the sde file"</SPAN>
sys<SPAN class="punctuation token">.</SPAN>exit<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
We are currently working a project to upgrade from Oracle 11g to 12c, and ESRI 10.0 to 10.4. In the previous environment our developers had a python script used as part of our install process that created and validated and SDE connection to the Oracle database. The python script has been tweaked for ESRI 10.4 / Oracle 12c. We are unable to get a connection using the script, but can connect from the server running ESRI 10.4 to the Oracle 12c database from both SQLPLUS and through ArcMAP. Above is the section of the script that is failing (we constantly get the "Unable to validate connection to SDE database).
Any thoughts on what may be wrong would be greatly appreciated. We are using the 32-bit Oracle client for the connection, but can't get it to work from the python script. Thanks for any help !!!
Tim