siddhartha veedaluru wrote:
But when i give user and pass information it is not able to create  the dsn
It is default local system user name and creating, which fails connecting to
database.

i gave the user information as following:
"SQL Server", SERVER="SQLSVR01",DESCRIPTION="MS SQL Server DSN",
DSN="MyDSN", DATABASE="Testing",uid="sa",pwd="sysadmin"):
if uid and pwd is not given then it creates the DSN with logged in user as
username.

Siddharrtha, the most useful thing you can do at this point is to post
some code, ideally with a traceback if one occurs. I'm finding it a little
difficult to understand what you're doing.

To take this forward, perhaps, the following code fragments use the pyodbc [1] module to connect to an MSSQL server with passthrough
authentication and with a specific username / password. I'm not
clear whether you're trying to do the same thing or something else,
but at least it'll provide a starting point for discussion :)

<code>
import pyodbc

def connection (server, database, username="", password="", **kwargs):
 connectors = ["Driver={SQL Server}"]
 connectors.append ("Server=%s" % server)
 connectors.append ("Database=%s" % database)
 if username:
     connectors.append ("UID=%s" % username)
     connectors.append ("PWD=%s" % password)
 else:
     connectors.append ("TrustedConnection=Yes")
 return pyodbc.connect (";".join (connectors), **kwargs)

db1 = connection ("SVR", "DB") # use passthrough authentication
db2 = connection ("SVR", "DB", "sa", "password") # use specific credentials

</code>

[1] http://pyodbc.sourceforge.net/
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to