Re: Problem with PGStatement.getLastOID() - Mailing list pgsql-jdbc
From | ListMan |
---|---|
Subject | Re: Problem with PGStatement.getLastOID() |
Date | |
Msg-id | 6.0.1.1.0.20031203164536.01cefad0@mail.cybermaccara.com Whole thread Raw |
In response to | Problem with PGStatement.getLastOID() (ListMan <listman@cybermaccara.com>) |
List | pgsql-jdbc |
At 06:22 2.12.2003, Oliver Jowett wrote: >If you do discover what triggers this behaviour, let me know & maybe we can >find a workaround. Well, I asked a former colleague who has some experience fixing early pgsql7.3 jdbc problems. He suggested to check if there is a proxy implementation introduced for statements. I found that the following patch seems to fix the ClassCastException. The reason this didn't exhibit itself with 7.3 drivers is because proxy instances were not implemented (or so I was told, didn't check the 7.3 sources myself ;) for statements, only for connections (and they had similar problems in the beginning). I briefly tested my changes and it fixed the problem we had. Didn't raise any immediate new problems either. (my test did only test createStatement case) Maybe you might like to review the patch and possibly commit the results to CVS? B Rgds, Jari Paljakka diff -c -r1.7 PooledConnectionImpl.java *** org/postgresql/jdbc2/optional/PooledConnectionImpl.java 25 Mar 2003 02:46:23 -0000 1.7 --- org/postgresql/jdbc2/optional/PooledConnectionImpl.java 3 Dec 2003 14:44:22 -0000 *************** *** 266,282 **** else if(method.getName().equals("createStatement")) { Statement st = (Statement)method.invoke(con, args); ! return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Statement.class}, new StatementHandler(this, st)); } else if(method.getName().equals("prepareCall")) { Statement st = (Statement)method.invoke(con, args); ! return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{CallableStatement.class}, new StatementHandler(this, st)); } else if(method.getName().equals("prepareStatement")) { Statement st = (Statement)method.invoke(con, args); ! return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{PreparedStatement.class}, new StatementHandler(this, st)); } else { --- 266,282 ---- else if(method.getName().equals("createStatement")) { Statement st = (Statement)method.invoke(con, args); ! return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Statement.class, org.postgresql.PGStatement.class}, new StatementHandler(this, st)); } else if(method.getName().equals("prepareCall")) { Statement st = (Statement)method.invoke(con, args); ! return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{CallableStatement.class, org.postgresql.PGStatement.class}, new StatementHandler(this, st)); } else if(method.getName().equals("prepareStatement")) { Statement st = (Statement)method.invoke(con, args); ! return Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{PreparedStatement.class, org.postgresql.PGStatement.class}, new StatementHandler(this, st)); } else {
pgsql-jdbc by date: