I think I've found the bug. There was a superfluous '?' symbol at the
end of the regex statement at line 837 in sql.py of web2py 1.64.3:

re.compile('^(?P<user>[^:@]+)(\:(?P<passwd>[...@]*))?@(?P<host>[^\:/]+)(\:(?P<port>[0-9]+))?/(?P<db>.+)(\?set_encoding=(?P<charset>\w+))?$'

should be

re.compile('^(?P<user>[^:@]+)(\:(?P<passwd>[...@]*))?@(?P<host>[^\:/]+)(\:(?P<port>[0-9]+))?/(?P<db>.+)(\?set_encoding=(?P<charset>\w+))$'

Now the regex catches both the path to the db file and the charset.

'set_encoding=None' now works fine and I can sucessfully connect to
the database.

I've run into another couple of issues that don't have to do with
connecting to Firbird. I'll post then in separate threads.

On Tue, Jun 23, 2009 at 9:38 AM, mdipierro<mdipie...@cs.depaul.edu> wrote:
>
> Can you help me debug why? Perhaps there is a typo in the regex?
>
> Massimo
>
> On Jun 22, 8:23 pm, Alexei Vinidiktov <alexei.vinidik...@gmail.com>
> wrote:
>> Thanks, Massimo!
>>
>> The auth.settings.password_field='password2' thing did the trick!
>>
>> I'm afraid the '?set_encoding=None' thing doesn't work.
>>
>> As I said earlier I tried using the string that you suggested:
>>
>> db = SQLDB('firebird://sysdba:passw...@localhost/employee.fdb?
>> set_encoding=None')
>>
>> but I got this error:
>>
>> "'isc_attach_database:   I/O error for file "employee.fdb?set_encoding=None"
>>  Error while trying to open file.  No such file or directory'"
>>
>>
>>
>> On Tue, Jun 23, 2009 at 4:46 AM, mdipierro<mdipie...@cs.depaul.edu> wrote:
>>
>> > ?set_encoding=None
>>
>> > should have the effect of not running "SET NAMES"
>>
>> > The other problem you have is that "password' cannot be used a field
>> > name by auth because it is a reserved in firebird.
>>
>> >   auth.settings.password_field='password2'
>>
>> > before auth.define_tables()
>>
>> > Massimo
>>
>> > On Jun 22, 9:42 am, Alexei Vinidiktov <alexei.vinidik...@gmail.com>
>> > wrote:
>> >> Thanks for your input, Jose.
>>
>> >> As I said earlier, I had tried commenting the lines that add SET NAMES
>> >> in sql.py, and I got a different error message that I quoted in a
>> >> previous email. Part of the traceback was:
>>
>> >>  self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
>> >> ProgrammingError: (-104, \'isc_dsql_prepare:   Dynamic SQL Error  SQL
>> >> error code = -104
>> >>  Token unknown - line 6, column 2  password\')'
>>
>> >> And the solution Massimo suggested didn't work either which I also
>> >> reported in a previous email.
>>
>> >> On Mon, Jun 22, 2009 at 10:36 PM, Jose<jjac...@gmail.com> wrote:
>>
>> >> > On 22 jun, 02:54, Alexei Vinidiktov <alexei.vinidik...@gmail.com>
>> >> > wrote:
>> >> >> Hello,
>>
>> >> >> I'm trying to make a connection to a Firebird db file, but I keep
>> >> >> getting this error:
>>
>> >> >> Traceback (most recent call last):
>> >> >>  File "/var/www/alvinru/data/www/bilingsoft.ru/gluon/restricted.py",
>> >> >> line 98, in restricted
>> >> >>  exec ccode in environment
>> >> >>  File 
>> >> >> "/var/www/alvinru/data/www/bilingsoft.ru/applications/notebook/models/db.py",
>> >> >> line 12, in <module>
>> >> >>  db = SQLDB(\'firebird://sysdba:passw...@localhost/employee.fdb\')
>> >> >>   File "/var/www/alvinru/data/www/bilingsoft.ru/gluon/sql.py", line
>> >> >> 837, in __init__
>> >> >>   self._execute(\'SET NAMES %s;\' % charset)
>> >> >>   File "/var/www/alvinru/data/www/bilingsoft.ru/gluon/sql.py", line
>> >> >> 835, in <lambda>
>> >> >>     self._execute = lambda *a, **b: self._cursor.execute(*a,**b)
>> >> >> ProgrammingError: (-104, \'isc_dsql_prepare:  Dynamic SQL Error  SQL
>> >> >> error code = -104
>> >> >> Token unknown - line 1, column 5  NAMES\')'
>>
>> >> >> My connection string in db.py is like this:
>>
>> >> >> db = SQLDB('firebird://sysdba:passw...@localhost/employee.fdb')
>>
>> >> >> I can successfully connect to the same database from the command line:
>>
>> >> >> import kinterbasedb
>> >> >> con = kinterbasdb.connect(
>> >> >>     host='localhost', database='employee.fdb',
>> >> >>     user='sysdba', password='password'
>> >> >>   )
>>
>> >> >> I'm using CentOS 5.2 with Python 2.5.4, Firebird 2.1.2 Super Server
>> >> >> and the latest version of web2py.
>>
>> >> >> I'd be grateful for any clues as to what might be happening.
>>
>> >> >> --
>> >> >> Alexei Vinidiktov
>>
>> >> > This had commented on it to Massimo, the instruction :
>> >> > SET NAMES
>> >> > It is not valid in firebird.
>>
>> >> > Jose
>>
>> >> --
>> >> Alexei Vinidiktov
>>
>> --
>> Alexei Vinidiktov
> >
>



-- 
Alexei Vinidiktov

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to