Monday, April 14, 2014

Re: I can't connect Django with SQL Anywhere 11 Database

You would be best advised to contact whoever supports that driver. Their contact information ought to be on their github site. My guess (as a maintainer of a different 3rd party Windows database driver) is that they have not upgraded to django 1.6 yet. But that's only a wild guess.
  The other strong possibility is that you have something wrong in your DATABASES dictionary, but only someone familiar with that driver would have an idea what.



On Monday, April 14, 2014 1:29:41 AM UTC-4, Elio Gerson Clímaco Herrera wrote:

Hi everybody...

 

I need connect django with sql anywhere 11 database, i follow the instructions on the page "SQL Anywhere Django Driver" from github.

 

I created the database with this command

C:\>dbinit -z UCA django.db --> (database created successful)

 

I started the Database Server with command

C:\>dbsrv11 django.db  --> (database server started successful)

 

I created my project with

C:\>django-admin.py startproject mysite (at this point all it's ok)

 

I edit the file mysite/mysite/settings.py and I changed the DATABASES setting with this

 

DATABASES = {

    'default': {

                        'ENGINE': 'sqlany_django',

                        'NAME': 'django',

                        'USER': 'dba',

                        'PASSWORD': 'sql',

                        'OPTIONS': {'eng': '2638'},

                        'HOST': 'django',

                        'PORT': '2638',

    }

}

 

The problem is, when I want sync database using this command

 

c:/mysite>python manage.py syncdb

 

 I get "Database server not found" error.

 

Please help me, I don't know how resolve this problem

 

Even I test the connection with a file (test_sqlany.py) this file contents following code

 

import sqlanydb

conn = sqlanydb.connect(uid='dba', pwd='sql', eng='django', dbn='django')

curs = conn.cursor()

curs.execute("select 'Hello, world!'")

print "SQL Anywhere says: %s" % curs.fetchone()

curs.close()

conn.close()

 

I, get get the expected output:

 

c:\>python test_sqlany.py

SQL Anywhere says: Hello, world!

 

I have an environment for test with this caracteristics

O.S.: Windows XP

DB Engine: SQL Anywhere 11 with EBF 3069

Python 2.7

Django 1.6.1

Setuptools installed

PIP installed

sqlanydb installed

sqlany-django installed

 

Sorry my english is very bad :)

 

Here is the complete text about this error

 

Traceback (most recent call last):

  File "manage.py", line 10, in <module>

    execute_from_command_line(sys.argv)

  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 

399, in execute_from_command_line

    utility.execute()

  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line

392, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 242,

 in run_from_argv

    self.execute(*args, **options.__dict__)

  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 285,

 in execute

    output = self.handle(*args, **options)

  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 415,

 in handle

    return self.handle_noargs(**options)

  File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py"

, line 57, in handle_noargs

    cursor = connection.cursor()

  File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 157,

 in cursor

    cursor = self.make_debug_cursor(self._cursor())

  File "C:\Python27\lib\site-packages\sqlany_django\base.py", line 476, in _curs

or

    self.connection = Database.connect(**kwargs)

  File "C:\Python27\lib\site-packages\sqlanydb.py", line 459, in connect

    return Connection(args, kwargs)

  File "C:\Python27\lib\site-packages\sqlanydb.py", line 508, in __init__

    self.handleerror(*error)

  File "C:\Python27\lib\site-packages\sqlanydb.py", line 518, in handleerror

    eh(self, None, errorclass, errorvalue)

  File "C:\Python27\lib\site-packages\sqlanydb.py", line 340, in standardErrorHa

ndler

    raise errorclass(errorvalue)

sqlanydb.OperationalError: Database server not found

 

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0898e08a-126c-437f-994f-d5a159f192ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment