pyodbc
データベース接続の管理に使用しています。OSI PI データベースに接続しようとすると、次のエラーが表示されます。
pyodbc.Error: ('IM002', "[IM002] [OSI][PI ODBC][PI]PI-API Error <pilg_getdefserverinfo> 0 (0) (SQLDriverConnectW); [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr). (0)")
ベンダーと話し合ったところ、次のような回答がありました。
Looks like pyodbc is written against ODBC 3.x. The OSI PI ODBC driver is using ODBC 2.0. The python ODBC driver manager will convert most ODBC 3 calls on the fly to ODBC 2 ones. Anything added to 3, however, will obviously fail. You would need to find some way to make sure that your only using 2.0 compliant ODBC calls. Currently their is not a PI ODBC driver that is compliant with ODBC 3.0.
この時点で接続を試みているだけなので、私のコードはかなり単純です。
import pyodbc
constr = 'DRIVER={PI-ODBC};SERVER=myserver;UID=MY_UID'
pyodbc.pooling=False
conn = pyodbc.connect(constr) # Error at this line
conn.close()
Python を OSI PI に接続した人はいますか? もしそうなら、どのようにしましたか?そうではなく、OSI データベースのデータをまだ使用している場合、どのようにしてアクセスしたのでしょうか?