[mod_python] Database access problems

William Witteman yam at nerd.cx
Fri Aug 29 09:58:36 EDT 2008


On Fri, Aug 29, 2008 at 02:34:57PM +0100, Peter Bleackley wrote:
> I'm currently setting up a web application, and am having a problem  
> connecting to databases. Whenever I try to create a connection object, 
> apache throws a segmentation fault and my client gets a zero-sized reply. 
> The server runs Solaris 10, apache 2.2.9, mod_python 3.3.1, python 2.5.2. 
> My database access is via pysqlite2 (I've tried sqlite3, that didn't work 
> either). The application runs under the publisher handler. I've checked 
> that apache has the correct access permissions for the directory where 
> the database resides, so that isn't the problem. Has anybody got any idea 
> what's wrong.

It is hard to say without a look at your code, but I wouldn't rule out a
permission problem quite yet.  I find that sudo is useful here, because
you can, as root, use sudo to run a command as the webserver from the
command line to see if there are permission errors that you would
otherwise not see.

When I started with sqlite and mod_python I built up my code from the
simplest examples I could muster - I start with an in-memory database,
open it, create a table, insert a value, read a value, quit.  Once I 've
got that working I use an empty file for the same procedure, which was
where I found my permission trouble (the apache logs might help in
seeing these).  Once I got that working it was easy.

Post a minimal sample of code if this doesn't help.
-- 

yours,

William



More information about the Mod_python mailing list