We help IT Professionals succeed at work.

Query SharePoint 2007 with ODBC

I need to qurey a list in my SharePoint 2007 site using ODBC from another web site and display the result set on a page in that site.
Watch Question

Director, Technology Solutions
I can see 3 options here:
1. create custom ODBC provider, working with SharePoint OM (will work only from SP server)
2. create custom ODBC provider, working with Web Services (will work from everywhere but harder to create)
3. try MS SQL Server ODBC provider to work directly with SP Content Database (good for really simple cases but please avoid this if possible)
You would be better off using the built in web services with sharepoint to retrieve info but if you want to go direct to the DB then it is just like any other data driven web page (although the DB/Table structure is like no other database!)

Do you know how to retrieve sql data from a web page? If so then you can do this.
Assuming the user doing the retrieving has read permissions within sharepoint

you will need to first learn the relevant IDs of your sharepoint layout webid, siteid, listid etc.

Really much easier if you use web services (they are sitting there ready and listening) and use a CAML query to select the data.

Here is a great tool for building caml queries to select sharepoint data