From: | ListMan <listman(at)cybermaccara(dot)com> |
---|---|
To: | Oliver Jowett <oliver(at)opencloud(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Problem with PGStatement.getLastOID() |
Date: | 2003-12-03 15:01:03 |
Message-ID: | 6.0.1.1.0.20031203164536.01cefad0@mail.cybermaccara.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
{
From | Date | Subject | |
---|---|---|---|
Next Message | CRAIG GOLBY | 2003-12-03 23:38:14 | RecordSets |
Previous Message | Lxir | 2003-12-03 12:37:54 | JDBC encoding |