2011/6/23 Richard <richb...@gmail.com>

> Hi Pierre,
>

Hi Richard,


>
> thanks for replying. I remember that I already stumbled upon the blog
> page you mention before I posted my question on this list. I admit
> that I didn't read it in depth back then. But I took as a good sign
> that you wrote in your final line: "Everything works fine and web2py
> runs with Jython. :-)"
>
> I did not read it in detail because your description was not quite
> matching with my prospective setup. My Linux distribution won't be
> quite the same, and as a restricted user I will certainly be in no
> position to install packages. In addition to that I didn't understand
> some details of your instructions. Why would it be necessary to build
> the SQLite native library? It is true that Jython comes *without* a
> sqlite3 module ("import sqlite3" fails on Jython). But that's why the
> zxJDBC driver has to be put into the classpath. When it is loaded it
> will be announced in the web2py startup with the line "Database
> drivers available: pymysql, zxJDBC". IMHO that should suffice.
>

I think the key here is understanding the differences between Python and
Jython. Jython runs in the Java environment. Jython access databases using
zxJDBC and zxJDBC access the databases using the Java JDBC infrastructure.
zxJDBC is itself an implementation of Python 2.0 DBI interface standard: the
interface Python uses to access databases.

If Jython has access to SQLite databases, it means Java has access to these
databases too. So it may be necessary to build these libraries so Java can
use them using JNI (Jana Native Interface). Python, not Jython, uses C
extensions while Jython does not because it uses Java.

I suggest reading
http://www.jython.org/jythonbook/en/1.0/DatabasesAndJython.html for better
understanding on the subject.


>
> I am certainly missing parts of the whole picture here, but if
> building a SQLite native library is a required step for setting up
> web2py on Jython, it certainly should be put into the "Official web2py
> Book". So far there is no mention of such a requirement now.
>

I don't think these issues are related to web2py. They are specific to
Jython.


> On the contrary, I believe the native sqlite library is not needed.
> Most convincing for me: When I start a clean source code install of
> web2py R-1.85.2 unter Jython/Linux and access the welcome app via
> browser, then a sqlite database automagically appears in the
> filesystemin a newly created folder 'databases'. Via admin app the
> database can be edited. For example I added a new user and then
> verified that the new entry was written to the database file.
>

It is already installed then.


>
> As an addititional note, when I verified this behaviour with R-1.85.2,
> I noticed a bug (attention Massimo). Unter Jython the name of the
> database, as declared in models/db.py, gets 'shortened'. With the
> standard declaration "db = DAL('sqlite://storage.sqlite')" the name of
> the file in folder 'databases' is  'ge.sqlite'. If I change the name
> in the declaration to 'richardstorage.sqlite' the real database file
> is named 'rdstorage.sqlite'. Somehow the first five chars get dropped
> unter Jython 2.5.2, verified unter Windows XP and Linux (Ubuntu
> derivative). No such error running this version of web2py under Python
> 2.6. I can't tell if this error still exist in hg tip since other
> errors stop me before that point :-(
>

I saw this bug before. It is not corrected or is the version too old?


>
> Regards,
> Richard
>



-- 


A+

-------------
Pierre
My blog and profile
(http://pierrethibault.posterous.com)<http://pierrethibault.posterous.com>
YouTube page 
(http://www.youtube.com/user/tubetib)<http://www.youtube.com/user/tubetib>
Twitter (http://twitter.com/pierreth2) <http://twitter.com/pierreth2>

Reply via email to