As far as I know, the only way to connect to MSSql using pyodbc on Linux is to use FreeTDS.
conn = pyodbc.connect(r"DRIVER={FreeTDS};SERVER=testserver \mssql2008;DATABASE=eoffice;UID=erp;PWD=123") The "SQL Server" driver is a Windows driver and the above connection string might work on the same Windows machine that you used to test the C#.NET connection. Also, if you're putting a backslash in a string, it either needs to be a raw string or needs to be escaped. I assume that since you posted this to the Django list that you intend to use it with django-pyodbc. On Jan 30, 1:31 am, Orgil <orgi...@gmail.com> wrote: > Hello, > I have pyodbc-2.1.8 and python-2.6 on ubuntu-10.4. > I tried to connect to MSSQL2008 database server which is on windows7. > My code is below: > ----------------------- > import pyodbc > conn = pyodbc.connect('DRIVER={SQL Server};SERVER=testserver > \mssql2008;DATABASE=eoffice;UID=erp;PWD=123') > ----------------------- > When I run this code, the following error occurs: > Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name > not found, and no default driver specified (0) (SQLDriverConnectW)') > > I tested the connection string using System.Data.Odbc library on > c#.net. It was fine. > I have no idea to solve my problem because of so general error > message. > > Please share your experience! > > regards, > Orgil -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.