Oh, in my example I put the connect string directly in db.py. But, just
take that out and put it in your private/appconfig.ini and it will work too.
'db2:pyodbc://dsn=web2py400;uid=myusername;pwd=mypassword;port=port'
-Jim
On Monday, November 2, 2015 at 11:37:33 AM UTC-6, Jim S wrote:
>
> I would recommend a modified version of Massimo's second example.
>
> 1. Setup a Client Access ODBC connection to your AS/400 database (make
> sure you used the right architecture, 32 bit if you have 32 bit python
> installed, 64 bit if 64 bit python)
> 2. Start and SQL session on the AS/400
> 3. Create a Schema (this will be the library where the files/tables will
> be stored) - CREATE SCHEMA web2py
> 4. From AS/400 command line, WRKOBJ web2py/*all - you'll see nothing
> there because you haven't yet created any files/tables
> 5. Use this DAL string in db.py:
>
> db =
> DAL('db2:pyodbc://dsn=web2py400;uid=myusername;pwd=mypassword;port=port',
> pool_size=myconf.take('db.pool_size', cast=int), check_reserved=['all'])
>
> 6. Fire up your app - the first time it will create all the auth tables
> for you.
> 7. Go back to the AS/400 and refresh the object list in the web2py
> library and you should see all of your auth tables
>
> Hope this helps!
>
> -Jim
>
>
>
>
>
> On Saturday, October 31, 2015 at 5:30:49 PM UTC-5, Massimo Di Pierro wrote:
>>
>> This is what the examples indicate as db2 syntax, and it depends on the
>> driver you have
>>
>> 'db2:ibm_db_dbi://DSN=dsn;UID=user;PWD=pass'
>>
>>
>> 'db2:pyodbc://driver=DB2;hostname=host;database=database;uid=user;pwd=
>> password;port=port'
>>
>> On Saturday, 31 October 2015 17:12:11 UTC-5, [email protected] wrote:
>>>
>>> I'm new to Python world and based on the recommendation web2py is the
>>> easiest way to learn about data and web integration. I need to access IBM
>>> DB2 database in AS400 to interact with web page.
>>>
>>> I been reading the guidelines, I define db2 connection string in
>>> private/appconfig with db2://username:password@test.
>>> The result was negative and this is what i get in message
>>>
>>> <type 'exceptions.SyntaxError'> Error in URI 'db2' or database not
>>> supportedVersionweb2py™Version 2.12.3-stable+timestamp.2015.0
>>> 8.19.00.18.03Traceback
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>>
>>> Traceback (most recent call last):
>>> File "C:\web2py\gluon\restricted.py", line 227, in restrictedexec ccode
>>> in environment File "C:/web2py/applications/
>>> <http://127.0.0.1:8000/admin/default/edit/as400app/models/db.py>as400app/models/db.py"
>>> <http://127.0.0.1:8000/admin/default/edit/as400app/models/db.py>, line 20,
>>> in <module>db = DAL(myconf.take('db.uri'),
>>> pool_size=myconf.take('db.pool_size', cast=int),
>>> check_reserved=['all'])File "C:\web2py\gluon\packages\dal\pydal\base.py",
>>> line 174, in __call__ obj = super(MetaDAL, cls).__call__(*args,
>>> **kwargs)File "C:\web2py\gluon\packages\dal\pydal\base.py", line 424, in
>>> __init__raise SyntaxError("Error in URI '%s' or database not supported" %
>>> self._dbname)SyntaxError: Error in URI 'db2' or database not supported
>>>
>>> <http://127.0.0.1:8000/admin/default/edit/as400app/models/db.py>
>>>
>>>
>>>
>>>
>>>
>>>
>>> can anyone help as I been working on this for a week.... Millions thank you
>>> in advanced.
>>>
>>>
--
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/d/optout.