Make sure everything is the same 32-bit or 64-bit version.
Such Blake T.
it is installed the 64 bit version.
Thank You
ArcGIS 10.2 uses 32 bits...
Incorrect ArcGIS server is a 64bit application now since 10.2. Desktop is 32.
thanks for your answers, exactly 10.2 ArcGis server uses 64 bits
Hi Ivan,
Are you sure pyodbc is available and accessible to the server?
I do have a few comments about the code itself. There are so many int-str conversions, it makes my head spin...
When reading the rows, if "Input_Sct", "Input_Ruta" and "Input_Secu" are values (integers), use this:
Input_Sct = "%03d" % (Input_Sct,) Input_Ruta = "%04d" % (Input_Ruta,) Input_Secu = "%05d" % (Input_Secu,)
If they are strings (or numbers), do this to format them:
Input_Sct ="{0}".format(Input_Sct).zfill(3) Input_Ruta ="{0}".format(Input_Ruta).zfill(4) Input_Secu ="{0}".format(Input_Secu).zfill(5)
Read more on formating, here: Some Python Snippets
To concatenate a string, it is better to use the format method on a string. It makes it a lot more easy to read.
To get the number if items in a list, just use:
contlist = len(lista_Ubica)
To create the where clause you could use something like this:
fldname = "clave2" fc = "Clientes" where = "{0} IN ('{1}')".format(arcpy.AddFieldDelimiters(fc, fldname), "','".join(lista_Ubica))
This will create a where clause with the following syntax:
clave2 IN ('123','abc','kjsjhadas')
At the end of your script you use arcpy.da.SearchCursor to get a count. Why? I think the result is the same as the arcpy.GetCount_management you perform just before...
Such xander_bakker.
Thank you very much for your kind response, I will consider your suggestions on the concatenation of string, but as you can check in my posting the error is in the pyodbc that ArcGis server does not recognize, it is installed the 64 bit version.
Thank You
Ivan
Yup you will most likely need the 64bit version of pyodbc. Also I noticed you are using a DSN to access your database. You should also make sure that you have the DSN setup in the correct ODBC manager on your windows server. Most likely if you are using 64bit it should be in the 64bit manager
That such.
We check the DSN connection and it works, I could query the data from Excel, including the tool can be run locally from ArcCatlog and allows me to issue you ArcGis Server as you can see in the attached image, the problem I think is that ArcGIS Server not recognizes the pyodbc library.
Thanks for your feedback
Ivan