FileMaker 11 server Advanced
Visual Studio Community 2015 (Python tools installed) Anaconda 32bit (It must be 32bit because of the odbc driver. 32bit and 64bit can coexist if devised at the time of installation)
https://www.continuum.io/downloads
I referred to this person. http://qiita.com/kyo-bad/items/75d88ce77660e3fa158c
FileMakerServer -FileMaker Server must be an advanced version (ODBC connection is not possible with the normal version) -It is assumed that ODBC settings and sharing settings for the target file are also made.
Python3 -Uses Anaconda 32bit (because there was only 32bit ODBC driver in FileMaker 11)
・ If Anaconda 64bit is installed as the main Tools (T)-> Options (O) ... Python Tools->Environment Options Create a new 32-bit setting with Project (P)-> (project name) Properties (E) ... General -> Interpreter: Make the settings you made.
ODBC -Installed with the enclosed ODBC installer in FileMaker
http://filemaker-jp.custhelp.com/app/answers/detail/a_id/9170/~/filemaker-11-installing -odbc- and -jdbc- client drivers
-When setting the DSN, set it in 32bit instead of 64bit. It can be set with "C: \ Windows \ SysWOW64 \ odbcad32.exe". (Not necessarily necessary work)
http://filemaker-jp.custhelp.com/app/answers/detail/a_id/9974/~/64-bit version -windows-about -odbc- connection in environment
Install pypyodbc as a preliminary preparation.
command prompt
%windir%\system32\cmd.exe "/K" "C:\Anaconda installation destination\Scripts\activate.bat" "C:\Anaconda installation destination"
pip install pypyodbc
Python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###coding: utf-Part 8 depends on the coding of the document
###File(F)->Advanced save option settings(V)...
###Document coding can be changed with
###In this case "Unicode"(UTF-8 No signature)-Code page 65001 "
###SHIFT-For JIS, cp932
import pypyodbc
def pypy():
cnn = pypyodbc.connect('DRIVER={FileMaker ODBC};SERVER=192.168.XXX.XXX:2399;UID=USER_NAME;PWD=PASSWORD;DATABASE=Filemaker.fp7')
cur = cnn.cursor()
#For Japanese fields, you must always enclose them in double quotes.
cur.execute("SELECT \"ID\",\"name\" from \"table name\" WHERE \"ID\" =number")
rows = cur.fetchall()
for row in rows:
print(row[1])
cur.close()
cnn.close()
if __name__ == "__main__":
pypy()
-The character code can be utf-8 or cp932, but match the #--coding: utf-8--parts.
Maybe I just made a mistake in my settings, but the program didn't work with the settings below. Especially when Japanese is involved, it becomes difficult to pass. pyodbc
Python3
import pyodbc
I was able to connect with pyodbc.connect, If cursor.execute (query) contains Japanese field, by all means 'utf-8' codec can't decode byte 0x8e in position 0: invalid start byte Could not be obtained due to an error such as (Even if you encode or decode with .encode ('utf-8') etc. or change the coding of the document) ADO
Python
import win32com.client
#DBConnection=win32com.client.Dispatch('ADODB.Connection')
#DBConnection.Open(ConnectionString)
The code passes, but I can't pick up the string value at all with XXX.Fields.Item (i) .Value
PyFileMaker Python3 not supported
Recommended Posts