You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Larry Low <ll...@telesphere.com> on 2011/04/27 23:04:47 UTC

[users@httpd] Apache DBD Sqlite3 - failed to prepare SQL statements: not an error

I'm not sure if this or the APR list was appropriate but the APR list seemed to only have a dev mailing list.

I am having trouble trying to get apache to use a sqlite3 database for authentication using dbd.  I get the following in my error log:

[Wed Apr 27 13:48:07 2011] [error] (20014)Internal error: DBD: failed to prepare SQL statements: not an error
[Wed Apr 27 13:48:07 2011] [error] [client x.x.x.x] Error looking up someuser in database

My configurations looks like this:

LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule dbd_module modules/mod_dbd.so

DBDriver sqlite3
DBDParams "/somewhere/file.db"
DBDPrepareSQL "SELECT password FROM users WHERE username=%s" my_query
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 60
DBDPersist Off

<Directory "/some/directory">
  Options FollowSymLinks
  AllowOverride AuthConfig
  AuthType Basic
  AuthName "Some Authorization Message"
  AuthBasicProvider dbd
  AuthDBDUserPWQuery my_query
  Order deny,allow
  <LimitExcept GET>
    Allow from all
  </LimitExcept>
</Directory>

The file.db is readable and writeable by apache and so is the directory so that sqlite can create its journal file.  (I've even tested letting apache create the initial db file just to verify.)

I've tried attaching httpd to gdb but I'm unused to performing troubleshooting at that level and can only confirm by setting a breakpoint at apr_dbd_prepare that the file database file is open at the time:

httpd     30937    apache   23u      REG       72,3      3072   32931846 /somewhere/file.db

I am using the CentOS 5 RPMS:
httpd-2.2.3-45.el5.centos
apr-1.2.7-11.el5_5.3
sqlite-3.3.6-5

I am close to scratching using sqlite3 and switching to postgresql but I wanted to avoid complicating the setup.
---
Larry Low

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache DBD Sqlite3 - failed to prepare SQL statements: not an error

Posted by Larry Low <ll...@telesphere.com>.
> > > I am having trouble trying to get apache to use a sqlite3 database
> > for authentication using dbd.  I get the following in my error log:
> > >
> > > [Wed Apr 27 13:48:07 2011] [error] (20014)Internal error: DBD:
> failed
> > to prepare SQL statements: not an error
> > > [Wed Apr 27 13:48:07 2011] [error] [client x.x.x.x] Error looking
> up
> > someuser in database
> >

I just upgraded to RHEL 6 and the problem goes away.  Must be a problem with sqlite or apr running on RHEL 5.  Needed to rebuild the servers I was working with anyways.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Apache DBD Sqlite3 - failed to prepare SQL statements: not an error

Posted by Larry Low <ll...@telesphere.com>.
> > I am having trouble trying to get apache to use a sqlite3 database
> for authentication using dbd.  I get the following in my error log:
> >
> > [Wed Apr 27 13:48:07 2011] [error] (20014)Internal error: DBD: failed
> to prepare SQL statements: not an error
> > [Wed Apr 27 13:48:07 2011] [error] [client x.x.x.x] Error looking up
> someuser in database
> 
> Ouch!  That error message smells of bug.
> 
> > My configurations looks like this:
> 
> Is DBDPersist Off something you just tried when it didn't work?
> I'm guessing you mean to turn it on in production.
> 
> Just as an experiment, what happens if you use DBDMin 0 ?

Correct, the DBDPersist Off is just for testing as I wanted to rule out any problems with database locking being the issue.

DBDMin had no effect.

> 
> > I've tried attaching httpd to gdb but I'm unused to performing
> troubleshooting at that level and can only confirm by setting a
> breakpoint at apr_dbd_prepare that the file database file is open at
> the time:
> 
> It would be good if you could step through that.
> Do you know anyone who is comfortable in gdb and could make
> a five-minute job of it?

I can try and stumble my way through it, was hoping this was just some small mistake as I've already wasted so much time trying to get it to work.

> 
> > I am close to scratching using sqlite3 and switching to postgresql
> but I wanted to avoid complicating the setup.
> 
> postgresql is great, but could be considered overkill for simple
> authentication.  And you certainly shouldn't have to change.

My thoughts exactly.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache DBD Sqlite3 - failed to prepare SQL statements: not an error

Posted by Nick Kew <ni...@webthing.com>.
On Wed, 27 Apr 2011 14:04:47 -0700
Larry Low <ll...@telesphere.com> wrote:

> I am having trouble trying to get apache to use a sqlite3 database for authentication using dbd.  I get the following in my error log:
> 
> [Wed Apr 27 13:48:07 2011] [error] (20014)Internal error: DBD: failed to prepare SQL statements: not an error
> [Wed Apr 27 13:48:07 2011] [error] [client x.x.x.x] Error looking up someuser in database

Ouch!  That error message smells of bug.

> My configurations looks like this:

Is DBDPersist Off something you just tried when it didn't work?
I'm guessing you mean to turn it on in production.

Just as an experiment, what happens if you use DBDMin 0 ?

> I've tried attaching httpd to gdb but I'm unused to performing troubleshooting at that level and can only confirm by setting a breakpoint at apr_dbd_prepare that the file database file is open at the time:

It would be good if you could step through that.
Do you know anyone who is comfortable in gdb and could make
a five-minute job of it?

> I am close to scratching using sqlite3 and switching to postgresql but I wanted to avoid complicating the setup.

postgresql is great, but could be considered overkill for simple
authentication.  And you certainly shouldn't have to change.

-- 
Nick Kew

Available for work, contract or permanent.
http://www.webthing.com/~nick/cv.html

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org