ODBC connection to FileMaker 11 Server Advanced with Python 3

environment

server

FileMaker 11 server Advanced

client

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

Setting

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

code

success

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.

Failure

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

ODBC connection to FileMaker 11 Server Advanced with Python 3
ODBC access to SQL Server from Linux with Python
Local server with python
Connect to BigQuery with Python
Connect to Wikipedia with Python
Post to slack with Python 3
UDP simultaneous connection with Python
Switch python to 2.7 with alternatives
Write to csv with Python
Easy HTTP server with Python
Connection pooling with Python + MySQL
screen and split screen with python and ssh login to remote server
Python: How to use async with
Link to get started with python
[Python] Write to csv file with Python
Create folders from '01' to '12' with python
Nice to meet you with python
Try to operate Facebook with Python
Output to csv file with Python
Convert list to DataFrame with python
MP3 to WAV conversion with Python
To do tail recursion with Python2
How to get started with Python
What to do with PYTHON release?
Unable to install Python with pyenv
How to use FTP with Python
How to calculate date with python
Easily post to twitter with Python 3
I want to debug with Python
Extract database tables with CSV [ODBC connection from R and python]
Upload & download wav file to X server (X-Server) by FTP with Python
Try to reproduce color film with Python
Try logging in to qiita with Python
Change Python 64bit environment to 32bit environment with Anaconda
English speech recognition with python [speech to text]
Convert memo at once with Python 2to3
HTML email with image to send with python
I tried to communicate with a remote server by Socket communication with Python.
[In-Database Python Analysis Tutorial with SQL Server 2017]
Memo to ask for KPI with python
Python to remember only with hello, worlds
Output color characters to pretty with python
Introduction to Python Image Inflating Image inflating with ImageDataGenerator
Output Python log to console with GAE
Data integration from Python app on Linux to Amazon Redshift with ODBC
Convert Excel data to JSON with python
Convert Hiragana to Romaji with Python (Beta)
Fractal to make and play with Python
Send mail with mailx to a dummy SMTP server set up with python.
I wanted to solve ABC160 with Python
Connect to MySQL with Python within Docker
How to work with BigQuery in Python
[Introduction to Python] Let's use foreach with Python
Push notification from Python server to Android
Single pixel camera to experience with Python
[Python] Introduction to CNN with Pytorch MNIST
Convert FX 1-minute data to 5-minute data with Python
I want to analyze logs with Python
How to do portmanteau test with python
I want to play with aws with python
How to display python Japanese with lolipop