You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Akacem Mohammed <Mo...@arbeitsagentur.de> on 2004/11/10 12:57:49 UTC
Classcastexception from Statement to ifmxSatetement
Hello,
I tried to use de dbcp1.2 und I follwowed the examples in dbcp commons.
I am using informix database.
I succeesed to get the connection and to execute a query.
but I failed to cast as follow:
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("com.informix.jdbc.IfxDriver");
ds.setUsername("unknown");
ds.setPassword("unknown");
ds.setUrl("my db url");
conn = ds.getConnection();
stmt = conn.createStatement();
stmt.executeUpdate(sqlstring);
// get Serial-Wert
IfmxStatement informixStatement= (IfmxStatement)stmt; // THE CASTING FAILED HIER !!
serialvalue = informixStatement.getSerial();
Althougt I earlier used the com.bimechanic.sql package for pooling and the same code above did work.
do I have to get a new driver from informix or is this a compatibility probleme.
thanks for any help
Mohammed
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: Classcastexception from Statement to ifmxSatetement
Posted by Tomasz Pik <to...@gmail.com>.
On Wed, 10 Nov 2004 12:57:49 +0100, Akacem Mohammed
<mo...@arbeitsagentur.de> wrote:
> Hello,
>
> I tried to use de dbcp1.2 und I follwowed the examples in dbcp commons.
[...]
> IfmxStatement informixStatement= (IfmxStatement)stmt; // THE CASTING FAILED HIER !!
// untested, but after looking at DBCP API
org.apache.commons.dbcp.DelegatingStatement delegating =
(org.apache.commons.dbcp.DelegatingStatement) stmt;
IfmxStatement informixStatement= (IfmxStatement) delegating.getDelegate();
>
> serialvalue = informixStatement.getSerial();
>
> Althougt I earlier used the com.bimechanic.sql package for pooling and the same code above did work.
Probably this package do not wrap connections/statements/resultsets as
DPCP does.
HTH,
Tomek
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org