I'm trying to connect 0.96-dev out of svn to a sql2k server, running
with a named instance.  I've seen that the connection string django
uses has a different style than what I've used with adodbapi before.
I've tried replicating the django connection string in a python
prompt, but that failed, too.

Has anyone else been able to get around similar errors?  Here's what I
get from django/python:

C:\eggs>django-admin.py inspectdb --settings=myapp.settings
Traceback (most recent call last):
  File "c:\python24\scripts\django-admin.py", line 5, in ?
    management.execute_from_command_line()
  File "C:\Python24\lib\site-packages\django\core\management.py", line 1358, in
execute_from_command_line
    for line in action_mapping[action]():
  File "C:\Python24\lib\site-packages\django\core\management.py", line 747, in i
nspectdb
    cursor = connection.cursor()
  File "C:\Python24\lib\site-packages\django\db\backends\ado_mssql\base.py", lin
e 72, in cursor
    self.connection = Database.connect(conn_string)
  File "C:\Python24\lib\site-packages\adodbapi\adodbapi.py", line 224, in connec
t
    raise DatabaseError(e)
adodbapi.adodbapi.DatabaseError: (-2147352567, 'Exception occurred.', (0, 'Micro
soft OLE DB Provider for SQL Server', '[DBNETLIB][ConnectionOpen (Connect()).]SQ
L Server does not exist or access denied.', None, 0, -2147467259), None)

The database does exist, and I've been able to connect to it with
Query Analyzer with the login, password, and server name I used in my
config file.  This is how django makes the connection:
            conn_string = "PROVIDER=SQLOLEDB;DATA
SOURCE=%s;UID=%s;PWD=%s;DATABASE=%s" % (settings.DATABASE_HOST,
settings.DATABASE_USER, settings.DATABASE_PASSWORD,
settings.DATABASE_NAME)
            self.connection = Database.connect(conn_string)

Here is how I've done it in the past:
>>> conn = adodbapi.connect('Driver={SQL
Server};Server=theServer,1533;Initial Catalog=theDatabase;User
ID=theUser;Password=thePassword;')

Do I need a DSN to make the connection?

[Time passes]

Ok, figured it out.  Since I've already put in the text, I'll write up
the answer so google gets smarter.  My db is on a non-standard port,
and that isn't picked up correctly in base.py yet.  So, the
work-around is to name the server SERVER,PORT in the settings file.
Like this:
DATABASE_HOST = 'dbServerName,1733'

And it now connects!

-- 
Andrew Diederich

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to