Here is a working example using server authentication on a server called
win2003, with a sqlserver instance name hcnsql07 and connecting to a
database called hcn using default ports
(I've added a couple of other parameters for performance.
Investigate lazy_tables, it makes a huge difference. )
db_ps_1TE = DAL('mssql://tim:password@win2003\hcnsql07/hcn',
lazy_tables=True, pool_size=10)
On Monday, 11 November 2013 07:10:43 UTC+11, Ariya Owam-aram wrote:
>
> Dear all,
>
> I have to connect mssql database which is locate on another server by
> using pyodbc.
>
> It working if connect by using
>
> pyodbc.connect(DNS=dns;UID=user_name;PWD=password)
>> <pyodbc.Connection at 0x391bdc0>
>>
>
> But I can't connect with DAL()
>
> db =
>> DAL("mssql://userName:[email protected]\SQLExpress,1433/myDatabase")
>
>
> return error as follow
>
>> Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not
>> found, and no default driver specified (0) (SQLDriverConnect)')
>
>
> As searching from web2py google group, I also try:
>
> db =
>> DAL("mssql://userName:[email protected]\SQLExpress,1433/myDatabase?Driver={FreeTDS}")
>
>
> return error as follow
>
> Error: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect
> to data source (0) (SQLDriverConnect)')
>
> ---------------------------
> in my /etc/odbc.ini
>
> [TS]
>> Description="ODBC Connection via FreeTDS"
>> Driver=FreeTDS
>> Server=203.xxx.xx.xxx
>> port=1433
>> Database=myDatabase
>
> ---------------------------
> in my /etc/odbcinst.ini
>
>> [FreeTDS]
>> Description=FreeTDS
>> Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
>> Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
>
> ---------------------------
> in my /etc/freetds/freetds.conf
>
> ### Did not change anything ###
>
> ---------------------------
> in my /etc/freetds/tds.driver.template
>
>> [TDS]
>> Description = FreeTDS Driver for Linux & MSSQL on Win32
>> Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
>> Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
>
> ---------------------------
> in my /etc/freetds/tds.dsn.template
>
> [DSN_NAME]
>
>> Description = Descripton of you DSN connection.
>> Driver = TDS
>> Trace = No
>> Database = myDatabase
>> Server = 203.xxx.xx.xxx
>> Port = 1433
>> TDS_Version = 8.0
>
>
>
>
> Thank you very much
> Ariya
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.