Profile picture for user knircky

Hello MashZone Community

I am having trouble running MashZone with Postgres 8.4. This is an open source database. From the release notes I understand that MashZone has not been tested with this database.

I am getting the following error message when trying to execute an sql query:

- "Method org.postgresql.jdbc4.Jdbc4Statement.setQueryTimeout(int) is not yet implemented."

I have been able to connect using several different JDBC drivers all with no problems, but all returning the same error message.

I am assuming that the JDBC drivers of postgres truly don't have time-outs implemented. I have googled the error message and found that other software vendors had to adjust their software accordingly.

Thus my questions: Is it possible to disable the timeout call while executing SQL queries to a database?

 

by Thomas Heib
Posted on Mon, 09/27/2010 - 09:26

Hello Phil,

the flaw occured in the postgres driver itself, unfortunately it obviously does not implement the complete java.sql.Statement interface, so the standard method "setQueryTimeout", which is adressed by MashZone to protect itself from not returning queries, throws this "Not-Implemented"-Exception. So there is no official way to disable the timeout restriction.

I think there are 2 approaches to solve your problem:

You might implement your own postgres-driver just by wrapping the genuine one and then simply catch the Not-Implemented Exception throw by the method, what is quite like hacking and might harm the Mashzone application during runtime.

The recommended and even more convenient solution is to look for a completely implemented postgre driver, perhaps a commercial one with some license fees.

Best regards

Thomas

0
by Phil Knirck Author
Posted on Tue, 09/28/2010 - 02:20

Thank you Thomas,

I am getting confused. This seems to be a very basic functionality. I've also seen some java testcode that made use of this setQueryTimout() call on a postgres sql "statement", which is where i would assume MashZone uses this function call as well.

Could I be doing something else wrong?

Postgres is one of the most popular and widely spread DBMS that is open source, it seems quite unusual that such basic functionality is not implemented.

Do we know of anyone that has run MashZone with Postgres?

I've also downloaded the jdbc driver from www.enterprisedb.com, however getting same error message. It looks like they are simply reusing the driver of the original DBMS.

It seems my only option is the built that wrapper JDBC driver and catch the SQL exception. I am not really very comfortable with it, but it seems to be the only way right now.

 

 

 

0
by Phil Knirck Author
Posted on Tue, 09/28/2010 - 02:22

http://jdbc.postgresql.org/todo.html clearly states that this is not implemented

Compliance

 

  • [JDBC1] Implement Statement.setQueryTimeout. →

Along with various forum posts.

0
by Thomas Heib
Posted on Tue, 09/28/2010 - 09:05

Hello Phil,

i took a look at the latest postgre driver source code, what is version 9.0-801 JDBC Source, and there i found this confusing implementation.

snippet from class org.postgresql.jdbc2.AbstractJdbc2Statement.java:

    public void setQueryTimeout(int seconds) throws SQLException

    {

        checkClosed();

        if (seconds < 0)

            throw new PSQLException(GT.tr("Query timeout must be a value greater than or equals to 0."),

                                    PSQLState.INVALID_PARAMETER_VALUE);



        if (seconds > 0)

            throw Driver.notImplemented(this.getClass(), "setQueryTimeout(int)");




        timeout = seconds;

    }


I think if you only comment these lines

 //       if (seconds > 0)

 //           throw Driver.notImplemented(this.getClass(), "setQueryTimeout(int)");

your problem is fixed. Finally you only have to create a jar file of the whole source and use it instead of the genuine distributed postgre driver.

For sure this is no official supported approach to get the postgre driver running with mashzone, but it should work this way. :-)

Best regards

Thomas

0
by Phil Knirck Author
Posted on Wed, 09/29/2010 - 07:10

Thats easy for you to say!

It took me a while to figure it out. The closest I came to hacking in the last 7 years, thats for sure.   Of course I had to download netbeans and learn to create a *.jar etc.

Anyway I managed to download the source code and change it. I also managed to built that jar file. However it did not work. So I copied my changed jdbc2 statement class from the non working jar file i had compiled into the newest driver from postgres and bingo that worked. I was able to connect and perform a select statement on the database.

Thank you so much for your support!!!

 

 

 

 

0
by Thomas Heib
Posted on Wed, 09/29/2010 - 08:55

You're welcome.

I am glad to hear that you were successful.

But please think twice before using this solution in a productive environment.

Best regards

Thomas

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock