Re: Connecting to SQL Server

2019-07-04 Thread John Burke
For this particular instance, I don't need the port number.

On Thu, Jul 4, 2019 at 11:47 AM Joe Reitman  wrote:

> Don't you need to assign a port number?
>
> On Wednesday, July 3, 2019 at 6:52:35 PM UTC-5, John Burke wrote:
>>
>> Trying to connect to SQL Server from Django
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'sql_server.pyodbc',
>> 'NAME': 'dbname',
>> 'HOST': 'hostname',
>> 'PORT': '',
>> 'USER': 'user',
>> 'PASSWORD': 'password',
>> 'OPTIONS': {
>> 'driver': 'ODBC Driver 13 for SQL Server',
>> },
>> }
>> }
>>
>>
>> I get the following error:
>> File "...\venv\lib\site-packages\sql_server\pyodbc\base.py", line 362, in
>> init_connection_state
>> val = cursor.execute('SELECT SYSDATETIME()').fetchone()[0]
>> ValueError: hour must be in 0..23
>>
>>
>> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/60dae4de-82b0-472c-987d-9fab48c37f0f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/60dae4de-82b0-472c-987d-9fab48c37f0f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Regards,
John B

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhYZ6CVS%2B4bJs0OwxK7KbY-mMgurvibpGOcmdFLYC_zJO0d3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connecting to SQL Server

2019-07-04 Thread John Burke
I don't actually supply the hour.  This is code in base.py.

The prior code sets up formatting:

datefirst = options.get('datefirst', 7)
cursor.execute('SET DATEFORMAT ymd; SET DATEFIRST %s' % datefirst)

I wonder if it is not getting executed successfully.


On Thu, Jul 4, 2019 at 11:10 AM Charlotte Wood <
charlotte.w...@epiccharterschools.org> wrote:

> It looks as if you have an odd value in there for the hour.  Do you?
>
>
> Charlotte Wood, MEd
>
> Educator
>
> (405) 578-5701
>
> Zoom Meeting ID#: 4055785701
>
> *Zoom URL:* https://epiccharterschools.zoom.us/j/2970513912
>
> Classroom Google Site:
> https://sites.google.com/epiccharterschools.org/charlottewoodclassroom/home
>
> Epic Technical Support: (405) 652-0935
>
>
>
> Jordan McKesson Principal
>
> 405-749-4550 ext. 309
>
> jordan.mckes...@epiccharterschools.org
>
> <http://facebook.com/epiccharterschools> <https://twitter.com/epiccharter>
> <https://www.instagram.com/epiccharterschools/>
> <https://www.youtube.com/user/EpicCharterSchools>
>
>
>
>
> On Wed, Jul 3, 2019 at 6:52 PM John Burke  wrote:
>
>> Trying to connect to SQL Server from Django
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'sql_server.pyodbc',
>> 'NAME': 'dbname',
>> 'HOST': 'hostname',
>> 'PORT': '',
>> 'USER': 'user',
>> 'PASSWORD': 'password',
>> 'OPTIONS': {
>> 'driver': 'ODBC Driver 13 for SQL Server',
>> },
>> }
>> }
>>
>>
>> I get the following error:
>> File "...\venv\lib\site-packages\sql_server\pyodbc\base.py", line 362, in
>> init_connection_state
>> val = cursor.execute('SELECT SYSDATETIME()').fetchone()[0]
>> ValueError: hour must be in 0..23
>>
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/58c14df7-0b4e-49dd-a19e-11c1101ff947%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/58c14df7-0b4e-49dd-a19e-11c1101ff947%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPZR0N6yPmqDRwfbSXNwUHOCR3%3DDcgTM_Ez_DcM7FbxjAsSFGA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPZR0N6yPmqDRwfbSXNwUHOCR3%3DDcgTM_Ez_DcM7FbxjAsSFGA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Regards,
John B

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhYZ6CjQwQz7zQNJ6BSjFHN%2B-aYXvp1a09ZX76x3dbc0kkjWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Connecting to SQL Server

2019-07-03 Thread John Burke
Trying to connect to SQL Server from Django

DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'dbname',
'HOST': 'hostname',
'PORT': '',
'USER': 'user',
'PASSWORD': 'password',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
},
}
}


I get the following error:
File "...\venv\lib\site-packages\sql_server\pyodbc\base.py", line 362, in 
init_connection_state
val = cursor.execute('SELECT SYSDATETIME()').fetchone()[0]
ValueError: hour must be in 0..23


-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/58c14df7-0b4e-49dd-a19e-11c1101ff947%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Connecting to SQL Server

2019-07-03 Thread John Burke
Getting the following error:

  File "...\venv\lib\site-packages\sql_server\pyodbc\base.py", line 362, in 
init_connection_state
val = cursor.execute('SELECT SYSDATETIME()').fetchone()[0]
ValueError: hour must be in 0..23

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4498b3d6-d65e-4ef2-a11d-82cddcd1b6a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.