More info: I have MacOSX and use iODBC with FreeTDS driver.
And looks like everything is OK:
FreeTDS:
[tu...@2kan-2:~/bigur]% tsql -S libra -p 1433 -U user
locale is "ru_RU.KOI8-R/UTF-8/ru_RU.KOI8-R/ru_RU.KOI8-R/ru_RU.KOI8-R/
ru_RU.KOI8-R"
locale charset is ""
Password:
1> select * from tax
2> go
<...>
(4 rows affected)
ODBC:
iodbctest "DSN=libra;UID=user;PWD=password"
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0406.1211
Driver: 0.82 (libtdsodbc.so)
SQL>...
And also I tried to connect with pyodbc:
tu...@2kan-2:~/bigur/calculation]% py
Python 2.5.2 (r252:60911, Feb 23 2009, 21:22:55)
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> pyodbc.connect("DSN=libra;UID=gik;PWD=123")
< pyodbc.connection object="object" at="at" 0x57620="0x57620" >
>>> c = _.cursor()
>>> c.execute("SELECT * from tax").fetchall()
<...>
On Feb 24, 9:04 pm, "Timothy N. Tsvetkov" <[email protected]>
wrote:
> Hi all, I'm new to SQLAlchemy, and I've a problem using it.
>
> [tu...@2kan-2:~/bigur/calculation]%
> python
> Python 2.5.2 (r252:60911, Feb 23 2009, 21:22:55)
> [GCC 4.0.1 (Apple Inc. build 5488)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from sqlalchemy import *
> >>> db =
> >>> create_engine('mssql://some_name:some_passwpod@/?dsn=Libra&driver=FreeTDS')
> >>> metadata = MetaData()
> >>> metadata.bind = db
> >>> metadata.bind.echo = True
> >>> users_table = Table('tax', metadata, autoload=True)
>
> 2009-02-24 20:54:55,261 INFO sqlalchemy.engine.base.Engine.0x...2850
> SELECT user_name() as user_name;
> 2009-02-24 20:54:55,261 INFO sqlalchemy.engine.base.Engine.0x...2850
> []
> 2009-02-24 20:54:55,280 WARNING sqlalchemy.pool.QueuePool.0x...27b0
> Error closing cursor: Attempt to use a closed cursor.
> 2009-02-24 20:54:55,280 INFO sqlalchemy.engine.base.Engine.0x...2850
> ROLLBACK
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/schema.py", line 113,
> in __call__
> return type.__call__(self, name, metadata, *args, **kwargs)
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/schema.py", line 241,
> in __init__
> _bind_or_error(metadata).reflecttable(self,
> include_columns=include_columns)
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/engine/base.py", line
> 1265, in reflecttable
> self.dialect.reflecttable(conn, table, include_columns)
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/databases/mssql.py",
> line 1123, in reflecttable
> current_schema = self.get_default_schema_name(connection)
> File "<string>", line 1, in <lambda>
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/engine/base.py", line
> 1894, in decorated
> connection.info[key] = val = fn(self, connection)
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/databases/mssql.py",
> line 1070, in get_default_schema_name
> user_name = connection.scalar(sql.text(query))
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/engine/base.py", line
> 814, in scalar
> return self.execute(object, *multiparams, **params).scalar()
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/engine/base.py", line
> 1676, in scalar
> self.connection._handle_dbapi_exception(e, None, None,
> self.cursor, self.context)
> File "/opt/local/lib/python2.5/site-packages/
> SQLAlchemy-0.5.3dev_r5814-py2.5.egg/sqlalchemy/engine/base.py", line
> 931, in _handle_dbapi_exception
> raise exc.DBAPIError.instance(statement, parameters, e,
> connection_invalidated=is_disconnect)
> sqlalchemy.exc.ProgrammingError: (ProgrammingError) Attempt to use a
> closed cursor. None None
>
> What I'm doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---