You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Raghu (JIRA)" <ji...@apache.org> on 2008/02/01 07:21:08 UTC
[jira] Created: (DBCP-259) defualtReadOnly not working in
conncetion pooling
defualtReadOnly not working in conncetion pooling
-------------------------------------------------
Key: DBCP-259
URL: https://issues.apache.org/jira/browse/DBCP-259
Project: Commons Dbcp
Issue Type: Bug
Affects Versions: 1.2.1
Environment: commons-pool 1.2, jdk 1.4
Reporter: Raghu
Hi All
I am trying to set up a connection pooling using Jakarta commons-dbcp 1.2.1....
When defaultReadOnly property is set to true and if my understanding is correct i would not be able to perform update,insert or delete operations.
When i set defualtReadOnly as true in the constructor PoolableConnectionFactory which looks like -
poolableConnectionFactory = new PoolableConnectionFactory(
connectionFactory, connectionPool, null,
"sql query", true, true);
But still i am able to perform the delete or insert opertations where i am expecting to throw an excpetion.
Am i missing some thing or is ther anything fishy???
Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DBCP-259) defualtReadOnly not working in
conncetion pooling
Posted by "Raghu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565273#action_12565273 ]
Raghu commented on DBCP-259:
----------------------------
This is excellent Phill.....
I really didnt think the setting the value of two boolean parameters can change the course of a program to this extent....
when i am doing this -
con.setAutoCommit(false);
con.setReadOnly(true);
I am getting the desired exception and now i can see some consistency.......Thanks for the help where i am struggling with this for past 2 days...but do you think the order is so much important...i dont want to drag the issue..this would be my last comment....
:-)
> defualtReadOnly not working in conncetion pooling
> -------------------------------------------------
>
> Key: DBCP-259
> URL: https://issues.apache.org/jira/browse/DBCP-259
> Project: Commons Dbcp
> Issue Type: Bug
> Affects Versions: 1.2.1
> Environment: commons-pool 1.2, jdk 1.4
> Reporter: Raghu
>
> Hi All
> I am trying to set up a connection pooling using Jakarta commons-dbcp 1.2.1....
> When defaultReadOnly property is set to true and if my understanding is correct i would not be able to perform update,insert or delete operations.
> When i set defualtReadOnly as true in the constructor PoolableConnectionFactory which looks like -
> poolableConnectionFactory = new PoolableConnectionFactory(
> connectionFactory, connectionPool, null,
> "sql query", true, true);
> But still i am able to perform the delete or insert opertations where i am expecting to throw an excpetion.
> Am i missing some thing or is ther anything fishy???
> Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DBCP-259) defualtReadOnly not working in conncetion
pooling
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz closed DBCP-259.
----------------------------
Resolution: Invalid
This is not a DBCP bug.
> defualtReadOnly not working in conncetion pooling
> -------------------------------------------------
>
> Key: DBCP-259
> URL: https://issues.apache.org/jira/browse/DBCP-259
> Project: Commons Dbcp
> Issue Type: Bug
> Affects Versions: 1.2.1
> Environment: commons-pool 1.2, jdk 1.4
> Reporter: Raghu
>
> Hi All
> I am trying to set up a connection pooling using Jakarta commons-dbcp 1.2.1....
> When defaultReadOnly property is set to true and if my understanding is correct i would not be able to perform update,insert or delete operations.
> When i set defualtReadOnly as true in the constructor PoolableConnectionFactory which looks like -
> poolableConnectionFactory = new PoolableConnectionFactory(
> connectionFactory, connectionPool, null,
> "sql query", true, true);
> But still i am able to perform the delete or insert opertations where i am expecting to throw an excpetion.
> Am i missing some thing or is ther anything fishy???
> Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DBCP-259) defualtReadOnly not working in
conncetion pooling
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565262#action_12565262 ]
Phil Steitz commented on DBCP-259:
----------------------------------
I am not an expert on how the Oracle driver handles these things, so I can't help much other than to explain what DBCP's PoolableConnectionFactory (PCF) does. Assuming you are using a pool with PCF as the factory and the constructor mentioned above, the sequence should be
1. getConnection or borrowObject directly from the pool causes a connection to get created using PCF's makeObject or returns one from the pool. Newly created connections do not have readOnly or autoCommit set.
2. commons pool's borrowObject then calls the PCF activateObject method. In that method, the autoCommit and readOnly properties are set *in that order* - i.e. in the reverse order from what you have in you "flat connection" example.
If you can identify a bug in DBCP (e.g. somehow setting the properties in the order that we do is not good), we can leave this issue open and find a solution here. Otherwise, we should close this and address further questions on the commons-user or Oracle lists.
> defualtReadOnly not working in conncetion pooling
> -------------------------------------------------
>
> Key: DBCP-259
> URL: https://issues.apache.org/jira/browse/DBCP-259
> Project: Commons Dbcp
> Issue Type: Bug
> Affects Versions: 1.2.1
> Environment: commons-pool 1.2, jdk 1.4
> Reporter: Raghu
>
> Hi All
> I am trying to set up a connection pooling using Jakarta commons-dbcp 1.2.1....
> When defaultReadOnly property is set to true and if my understanding is correct i would not be able to perform update,insert or delete operations.
> When i set defualtReadOnly as true in the constructor PoolableConnectionFactory which looks like -
> poolableConnectionFactory = new PoolableConnectionFactory(
> connectionFactory, connectionPool, null,
> "sql query", true, true);
> But still i am able to perform the delete or insert opertations where i am expecting to throw an excpetion.
> Am i missing some thing or is ther anything fishy???
> Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DBCP-259) defualtReadOnly not working in
conncetion pooling
Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565029#action_12565029 ]
Phil Steitz commented on DBCP-259:
----------------------------------
Your understanding may not be correct, depending on the JDBC driver and database. PoolableConnectionFactory will invoke the underlying Connection's setReadOnly(true) method when a PoolableConnection with defaultReadOnly = true is activated. What that means in practice regarding what can be done with the connection, what is optimized, etc. depends on the driver. The driver documentation should say whether or not and how readOnly connections are supported.
> defualtReadOnly not working in conncetion pooling
> -------------------------------------------------
>
> Key: DBCP-259
> URL: https://issues.apache.org/jira/browse/DBCP-259
> Project: Commons Dbcp
> Issue Type: Bug
> Affects Versions: 1.2.1
> Environment: commons-pool 1.2, jdk 1.4
> Reporter: Raghu
>
> Hi All
> I am trying to set up a connection pooling using Jakarta commons-dbcp 1.2.1....
> When defaultReadOnly property is set to true and if my understanding is correct i would not be able to perform update,insert or delete operations.
> When i set defualtReadOnly as true in the constructor PoolableConnectionFactory which looks like -
> poolableConnectionFactory = new PoolableConnectionFactory(
> connectionFactory, connectionPool, null,
> "sql query", true, true);
> But still i am able to perform the delete or insert opertations where i am expecting to throw an excpetion.
> Am i missing some thing or is ther anything fishy???
> Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DBCP-259) defualtReadOnly not working in
conncetion pooling
Posted by "Raghu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DBCP-259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565252#action_12565252 ]
Raghu commented on DBCP-259:
----------------------------
Yes Phil
Thanks for you response. I got to know that the property of ReadOnly depends on the driver you are using and that is absolutely correct and well understood.
Now i have a strange problem.
I am testing this defualt readonly property in 2 different cases.
1.Just trying to obtain a connection as a flat connection -
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("url","user","paswd");
con.setReadOnly(true);
con.setAutoCommit(false);
PreparedStatement pstmt = con.prepareStatement("DELETE query'");;
int x = pstmt.executeUpdate();
con.commit();
con.close();
System.out.println(x);
Here even when i am trying to set the readOnly to true still i am able to perform the delete or update or insert operations...but as we know that Oracle JDBC driver doesnt support that i dont have any issues here....
2.In the second case i am trying to obtain a conneciton from a datasource by constructing a connection pooling....
now here when i am using the constructor -
poolableConnectionFactory = new PoolableConnectionFactory(
connectionFactory, connectionPool, null,
"sql query", true, false);
i have set the auto commit as false now when i am trying to perform an udate query it throwing the exception.(Here also i am using the Oracle JDBC driver only...)
but when i am setting the constructor -
poolableConnectionFactory = new PoolableConnectionFactory(
connectionFactory, connectionPool, null,
"sql query", true, true);
here auto commit is true....and now it is not throwing any exception.....
why is this incosistency in all these 3 cases.....
Thanks for reading my mail patiently..........
> defualtReadOnly not working in conncetion pooling
> -------------------------------------------------
>
> Key: DBCP-259
> URL: https://issues.apache.org/jira/browse/DBCP-259
> Project: Commons Dbcp
> Issue Type: Bug
> Affects Versions: 1.2.1
> Environment: commons-pool 1.2, jdk 1.4
> Reporter: Raghu
>
> Hi All
> I am trying to set up a connection pooling using Jakarta commons-dbcp 1.2.1....
> When defaultReadOnly property is set to true and if my understanding is correct i would not be able to perform update,insert or delete operations.
> When i set defualtReadOnly as true in the constructor PoolableConnectionFactory which looks like -
> poolableConnectionFactory = new PoolableConnectionFactory(
> connectionFactory, connectionPool, null,
> "sql query", true, true);
> But still i am able to perform the delete or insert opertations where i am expecting to throw an excpetion.
> Am i missing some thing or is ther anything fishy???
> Thanks
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.