From: DJ G. <dj...@op...> - 2008-03-22 17:43:35
|
Alejandro, I don't know if you noticed, but Ben fixed this by going at it a different way, by eliminating the use of to_timestamp altogether and using Java SQL Timesamp objects: http://bugzilla.opennms.org/show_bug.cgi?id=2261#c6 - djg On Thu, 13 Mar 2008 16:11:30 -0430, "Alejandro Galue" <ag...@sy...> said: > Hello All, > > First off all, in my opinion, this two bugs are related > (same Exception with postgresql and Filters) > > I did some tests and now I'm more confused. I add a comment > on org.opennms.web.event.EventFactory.getEvents to display > a log message with the generated SQL (just before > preparedStatement), and add a comment on > org.opennms.web.event.filter.BeforeDateFilter.bindParams, > to see which parameters is passed to preparedStatement. > > The generated SQL is: > > jetty.log:2008-03-13 16:00:41,630 INFO [btpool0-3] > JettyServer: FILTER_SQL_TEST: SELECT events.*, > node.nodelabel, service.servicename FROM node > RIGHT OUTER JOIN events ON (events.nodeid = > node.nodeid) LEFT OUTER JOIN service ON > (service.serviceid = events.serviceid) WHERE > EVENTACKUSER IS NULL AND EVENTTIME < to_timestamp(?, ?) AND > EVENTDISPLAY='Y' ORDER BY EVENTID DESC LIMIT 10 OFFSET 0 > > and, the parameters to bind are: > > jetty.log:2008-03-13 16:00:41,630 INFO [btpool0-3] > JettyServer: FILTER_SQL_TEST: Thu Mar 13 16:00:00 VET 2008, > 'Dy Mon DD HH24:MI:SS Tz YYYY' > > If I manually edit the SQL and run it directly on > postgresql, it works. The query was: > > SELECT events.*, node.nodelabel, service.servicename > FROM node RIGHT OUTER JOIN events ON > (events.nodeid = node.nodeid) LEFT OUTER JOIN service > ON (service.serviceid = events.serviceid) > WHERE EVENTACKUSER IS NULL AND EVENTTIME < > to_timestamp('Thu Mar 13 16:00:00 VET 2008', 'Dy Mon DD > HH24:MI:SS Tz YYYY') AND EVENTDISPLAY='Y' ORDER BY EVENTID > DESC LIMIT 10 OFFSET 0 > > So, if the syntax are write, the problem could be the > binding or the postgresql driver. > > I modified EventConstants.POSTGRES_DATE_FORMAT to remove > quotes, but the log still show me the quotes (and yes, I > generate a new opennms-services jar, overwrite the old one > on opennms/lib and restart opennms). > > What is happening here? > > Regards, > Alejandro. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Please read the OpenNMS Mailing List FAQ: > http://www.opennms.org/index.php/Mailing_List_FAQ > > opennms-devel mailing list > > To *unsubscribe* or change your subscription options, see the bottom of > this page: > https://lists.sourceforge.net/lists/listinfo/opennms-devel |