On Apr 19, 9:18 pm, Page3D <pag...@gmail.com> wrote: > Hi, I am trying to connect and access data in a *.sdf file on Win7 > system using Python 2.7. I have three questions: > > 1. What python module should I use? I have looked at sqlite3 and > pyodbc. However, I can seem to get the connection to the database file > setup properly.
I assume you mean SQL Server Compact by *.sdf. However please note that there are several several file formats matching SDF http://en.wikipedia.org/wiki/SDF#Computing and explicit is better than implicit. The sqlite3 module won't help - that's for sqlite files, which an entirely different file format. Wikpedia says of SQL Server Compact "An ODBC driver for SQL CE does not exist, and one is not planned either. Native applications may use SQL CE via OLE DB" http://en.wikipedia.org/wiki/SQL_Server_Compact. I believe the adodbapi module, part of PyWin32 http://sourceforge.net/projects/pywin32/files/ can connect over OLE DB. > 2. How can I determine the appropriate connection string? I have > opened database file in Visual Studio and can see the tables. I don't > understand where to find the connection string in Visual Studio. These look promising http://www.connectionstrings.com/sql-server-2005-ce > 3. Assuming a module from (1) above, does anyone have a code snippet > for connecting to the database and then accessing a varbinary (image) > in one of the tables of the databese? Pass, I'm afraid Regards, Alex -- http://mail.python.org/mailman/listinfo/python-list