Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Can't use DB name with dashes using pymssql ???

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


samuel.morhaim at gmail

Aug 13, 2008, 1:54 PM

Post #1 of 5 (186 views)
Permalink
Can't use DB name with dashes using pymssql ???

I tried:

import sys
import pymssql

db = 'Gcare4UI-B6_3_dev'

conn = pymssql.connect (host = "localhost",
user = "myname",
password = "mypassword",
database = db)



And this returns an error saying
Could not locate entry in sysdatabases for database 'Gcare4UI'. No entry
found with that name.

It is not reading the db name after the Dash... if i remove the dash from
the db to see what happens, it shows this obvious error, because it doesnt
exist... i was just making sure the problem was with the dash

Could not locate entry in sysdatabases for database 'Gcare4UIB6_3_dev'. No
entry found with that name.

Anyone had this problem?

Thanks.


samuel.morhaim at gmail

Aug 13, 2008, 3:30 PM

Post #2 of 5 (173 views)
Permalink
Re: Can't use DB name with dashes using pymssql ??? [In reply to]

I believe there is a bug in Python.. _mssql ... I am not too familiar
with Python yet, but after adding several breakpoints and watching the
variable, the last step of pymssql.py is

# open the connection
con = _mssql.connect(dbhost, dbuser, dbpasswd)

con.select_db(dbbase)


At this point the contents of dbbase is "Gcare4UI-B6_3_dev" (no quotes)...
however, the immediate error is that
"Gcare4UI" does not exist.

Again removing the DASH from Gcare4UI-B6_3_dev and turning it into
Gcare4UIB6_3_dev results in error that can't find DB Gcare4UIB6_3_dev (of
course because the DB without the - doesnt exist... )

please help... thanks.


On Wed, Aug 13, 2008 at 4:54 PM, Samuel Morhaim <samuel.morhaim[at]gmail.com>wrote:

> I tried:
>
> import sys
> import pymssql
>
> db = 'Gcare4UI-B6_3_dev'
>
> conn = pymssql.connect (host = "localhost",
> user = "myname",
> password = "mypassword",
> database = db)
>
>
>
> And this returns an error saying
> Could not locate entry in sysdatabases for database 'Gcare4UI'. No entry
> found with that name.
>
> It is not reading the db name after the Dash... if i remove the dash from
> the db to see what happens, it shows this obvious error, because it doesnt
> exist... i was just making sure the problem was with the dash
>
> Could not locate entry in sysdatabases for database 'Gcare4UIB6_3_dev'. No
> entry found with that name.
>
> Anyone had this problem?
>
> Thanks.
>
>


fredrik at pythonware

Aug 13, 2008, 3:39 PM

Post #3 of 5 (174 views)
Permalink
Re: Can't use DB name with dashes using pymssql ??? [In reply to]

Samuel Morhaim wrote:

> I believe there is a bug in Python.. _mssql ... I am not too familiar
> with Python yet, but after adding several breakpoints and watching the
> variable, the last step of pymssql.py is
>
> # open the connection
> con = _mssql.connect(dbhost, dbuser, dbpasswd)
>
>
> con.select_db(dbbase)
> At this point the contents of dbbase is "Gcare4UI-B6_3_dev" (no
> quotes)... however, the immediate error is that
> "Gcare4UI" does not exist.

reading the documentation might help:

http://pymssql.sourceforge.net/troubleshooting.html#dbid

</F>

--
http://mail.python.org/mailman/listinfo/python-list


samuel.morhaim at gmail

Aug 13, 2008, 3:40 PM

Post #4 of 5 (173 views)
Permalink
Re: Can't use DB name with dashes using pymssql ??? [In reply to]

And.. confirmed.. it has to be a bug in Python _mssql.


#sample.py
import _mssql

dbhost = 'gmed-4-int'
dbuser = 'myuser'
dbpasswd = 'mypassword'
dbbase = 'Gcare4UI-B6_3_dev'
con = _mssql.connect(dbhost, dbuser, dbpasswd)
con.select_db(dbbase)

...
Could not locate entry in sysdatabases for database 'Gcare4UI'

=======

I have confirmed the db Gcare4UI-B6_3_dev does exist. I also tried
connecting to one of the other DB in the same server that do not contain a
DASH in the name and the connection was successful.

How can I fix this? Do I report this as a bug? Can somebody point me in the
right direction?

Thank you.







On Wed, Aug 13, 2008 at 6:30 PM, Samuel Morhaim <samuel.morhaim[at]gmail.com>wrote:

> I believe there is a bug in Python.. _mssql ... I am not too familiar
> with Python yet, but after adding several breakpoints and watching the
> variable, the last step of pymssql.py is
>
> # open the connection
> con = _mssql.connect(dbhost, dbuser, dbpasswd)
>
> con.select_db(dbbase)
>
>
> At this point the contents of dbbase is "Gcare4UI-B6_3_dev" (no quotes)...
> however, the immediate error is that
> "Gcare4UI" does not exist.
>
> Again removing the DASH from Gcare4UI-B6_3_dev and turning it into
> Gcare4UIB6_3_dev results in error that can't find DB Gcare4UIB6_3_dev (of
> course because the DB without the - doesnt exist... )
>
> please help... thanks.
>
>
>
> On Wed, Aug 13, 2008 at 4:54 PM, Samuel Morhaim <samuel.morhaim[at]gmail.com>wrote:
>
>> I tried:
>>
>> import sys
>> import pymssql
>>
>> db = 'Gcare4UI-B6_3_dev'
>>
>> conn = pymssql.connect (host = "localhost",
>> user = "myname",
>> password = "mypassword",
>> database = db)
>>
>>
>>
>> And this returns an error saying
>> Could not locate entry in sysdatabases for database 'Gcare4UI'. No entry
>> found with that name.
>>
>> It is not reading the db name after the Dash... if i remove the dash from
>> the db to see what happens, it shows this obvious error, because it doesnt
>> exist... i was just making sure the problem was with the dash
>>
>> Could not locate entry in sysdatabases for database 'Gcare4UIB6_3_dev'. No
>> entry found with that name.
>>
>> Anyone had this problem?
>>
>> Thanks.
>>
>>
>


fredrik at pythonware

Aug 13, 2008, 3:49 PM

Post #5 of 5 (174 views)
Permalink
Re: Can't use DB name with dashes using pymssql ??? [In reply to]

Fredrik Lundh wrote:

> reading the documentation might help:
>
> http://pymssql.sourceforge.net/troubleshooting.html#dbid

also see the SQL server reference documentation (the section "Rules for
Regular Identifiers" describes the valid syntax):

http://msdn.microsoft.com/en-us/library/ms175874.aspx

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.