473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Connecting to SQL-Server

Hello-

I'm running Python 2.3 on a Windows XP box and am trying to get connected to
an MS SQL-Server. I have found (seemingly) conflicting methods to connect
using the odbc module in the win32-all extensions. I have seen both of the
following:

db = odbc.odbc('DSN/UID/PASSWORD)
and
db=odbc.odbc('DSN=dsn;UID=uid;PWD=password)

I can connect when I use my computer, but when I transfer the code to a
production box I am greeted with an error that the login is not associated
with a trusted connection. So which, if either, of the above methods should
I use and what is the error about a trusted connection trying to tell me?

Thanks for your help!

Greg Lindstrom (501) 975-4859
NovaSys Health gr************@novasyshealth.com

"We are the music makers, and we are the dreamers of dreams" W.W.

Jul 18 '05 #1
1 2214
[Greg Lindstrom]
I'm running Python 2.3 on a Windows XP box and am trying to get connected to
an MS SQL-Server. I have found (seemingly) conflicting methods to connect
using the odbc module in the win32-all extensions. I have seen both of the
following:

db = odbc.odbc('DSN/UID/PASSWORD)
and
db=odbc.odbc('DSN=dsn;UID=uid;PWD=password)


[... snip description of problem solved by other people ...]

I know I'm coming late to this particular party now that
others have solved the particular problem. But I wanted to
offer a couple of things. One is this page (just in case you
hadn't come across it):

http://www.able-consulting.com/ADO_Conn.htm

I come back here every time I have a problem with an
ODBC connection string.

On the back of that, I almost always use a DSN-less
connection something like this:

<code>
import odbc

dsn = [
"Driver={SQL Server}",
"Server=VODEV1",
"Database=EVOTEST",
"UID=evoreader",
"Pwd=***"
]

db = odbc.odbc (";".join (dsn))
</code>

or, for trusted connections:

<code>
import odbc

trusted_dsn = [
"Driver={SQL Server}",
"Server=VODEV1",
"Database=EVOTEST",
"Trusted_Connection=yes"
]

db = odbc.odbc (";".join (trusted_dsn))
</code>

Obviously the server / database etc. can be variables
pulled from a configuration file etc. This way, I
don't have to set up a system/user-dsn on each computer
I run on.

TJG
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wayne Happ | last post by:
I have Oracle 9 running on a Linux RedHat Box V9.0. But I'm having trouble connecting from a windows machine via PL/SQL Develover. When I startup the application the instance name appears but...
1
by: pmud | last post by:
Hi I need to connect an existing application to an SQL database. How to go about doing that coz its an application created by a third party & I dont even know how or in what programming language...
10
by: ej1008 | last post by:
HI all I am having a windows Control running on ASP.Net webform. From this windows control I am trying to connect to database to do some database operations. Now I am facing problem while...
5
by: Al | last post by:
Hi, I am looking for sample VB.net code for working with Access 97 database. I know how to work with SQL but I dont know how to read and writ into access 97. Any help is very much appreciated. ...
0
by: satish | last post by:
hi, i have a problem while connecting the Folder in executing sql task in execute sql statements in loop example in Intergration Services --2005 the actual problem -- i have given the sql source...
29
by: Bryce K. Nielsen | last post by:
Suddenly this week, I've started getting this error message: System.Data.SqlClient.SqlConnection(GetOpenConnection)ExecuteNonQuery requires an open and available Connection. The connection's...
3
by: olafbrungot | last post by:
I get the following error message when trying to connect to a host database (OBCD connection) with "MS Query". SQL0471N Invocation of routine "SYSIBM .SQLTABLES " failed due to reason...
0
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've my win32 application which connecting to my sql database. till now i used MSDE as my database and now i want to upgrade to sql express 2005. after the upgrade i tried to connect to the...
5
by: Darin | last post by:
This is going to be pretty vague. Our software was using the 1.1 version of the .NET framework and things were fine. In March we upgraded to using the 2.0 framework, and the visual studio 2005....
8
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql with java in eclipse environment. Coding Part: import java.sql.Connection; import java.sql.DriverManager; public class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.