*.sdf database access

P

Page3D

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.

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.

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?

Thanks in advance. Dave
 
A

Alex Willmer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top