Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDBC driver properties can't be modified #48

Open
fuero opened this issue Jun 7, 2015 · 3 comments
Open

JDBC driver properties can't be modified #48

fuero opened this issue Jun 7, 2015 · 3 comments

Comments

@fuero
Copy link

fuero commented Jun 7, 2015

Hi,

I'm trying to get rid of these messages:

No rules for diffs:modify:/jdbc-driver/oracle-driver/driver-module-name value="com.oracle.ojdbc6"(/jdbc-driver/oracle-driver/driver-module-name value="com.oracle.ojdbc6:main")
modify:/jdbc-driver/oracle-driver/driver-datasource-class-name value="oracle.jdbc.OracleDatasource"(/jdbc-driver/oracle-driver/driver-datasource-class-name value=undefined)
modify:/jdbc-driver/oracle-driver/xa-datasource-class value="oracle.jdbc.xa.client.OracleXADataSource"(/jdbc-driver/oracle-driver/xa-datasource-class value=undefined)
modify:/jdbc-driver/oracle-driver/module-slot value="main"(/jdbc-driver/oracle-driver/module-slot value=undefined)

The file creating the datasource looks like this:

{ 
  "jdbc-driver" => { 
    "oracle-driver" => 
    {
        "driver-name" => "oracle-driver",
        "driver-module-name" => "com.oracle.ojdbc6",
        "driver-datasource-class-name" => "oracle.jdbc.OracleDatasource",
        "driver-xa-datasource-class-name" => "oracle.jdbc.xa.client.OracleXADataSource",
        "xa-datasource-class" => "oracle.jdbc.xa.client.OracleXADataSource",
        "driver-class-name" => "oracle.jdbc.driver.OracleDriver",
        "module-slot" => "main",
    }
  }
}

I've tried adding a rule to jdbc-driver allowing the attributes to be modified, but it doesn't behave as expected, because the attributes are readonly.

Furthermore it seems that driver-module-name needs to be used differently than when creating the driver (com.oracle.ojdbc6 vs. com.oracle.ojdbc6:main),
so treating it like system-properties would just cause endless restarts again, right?

@bserdar
Copy link
Owner

bserdar commented Jun 8, 2015

Trying to configure jdbc drivers caused a lot of problems before. All of
the properties are read-only, so the only way to change anything is to
first remove the driver (which also used to be broken, I don't know if they
fixed that), and then reinsert it.

Trying to change the properties will cause endless refreshes. The modify
rule runs, attempting to modify a property, but it is not modified, so when
the configuration is re-read, the property still has the old value, which
triggers the same rule again. A while ago I added some logic to detect
repetitive failures, I don't know if that logic detects this particular
case.

In short, if you need to change anything with jdbc drivers, remove them
first. Let me know if you have a better solution.

Thanks.

On Sun, Jun 7, 2015 at 8:15 AM, fuero [email protected] wrote:

Hi,

I'm trying to get rid of these messages:

No rules for diffs:modify:/jdbc-driver/oracle-driver/driver-module-name value="com.oracle.ojdbc6"(/jdbc-driver/oracle-driver/driver-module-name value="com.oracle.ojdbc6:main")
modify:/jdbc-driver/oracle-driver/driver-datasource-class-name value="oracle.jdbc.OracleDatasource"(/jdbc-driver/oracle-driver/driver-datasource-class-name value=undefined)
modify:/jdbc-driver/oracle-driver/xa-datasource-class value="oracle.jdbc.xa.client.OracleXADataSource"(/jdbc-driver/oracle-driver/xa-datasource-class value=undefined)
modify:/jdbc-driver/oracle-driver/module-slot value="main"(/jdbc-driver/oracle-driver/module-slot value=undefined)

The file creating the datasource looks like this:

{
"jdbc-driver" => {
"oracle-driver" =>
{
"driver-name" => "oracle-driver",
"driver-module-name" => "com.oracle.ojdbc6",
"driver-datasource-class-name" => "oracle.jdbc.OracleDatasource",
"driver-xa-datasource-class-name" => "oracle.jdbc.xa.client.OracleXADataSource",
"xa-datasource-class" => "oracle.jdbc.xa.client.OracleXADataSource",
"driver-class-name" => "oracle.jdbc.driver.OracleDriver",
"module-slot" => "main",
}
}
}

I've tried adding a rule to jdbc-driver allowing the attributes to be
modified, but it doesn't behave as expected, because the attributes are
readonly.

Furthermore it seems that driver-module-name needs to be used differently
than when creating the driver (com.oracle.ojdbc6 vs.
com.oracle.ojdbc6:main),
so treating it like system-properties would just cause endless restarts
again, right?


Reply to this email directly or view it on GitHub
#48.

@fuero
Copy link
Author

fuero commented Jun 8, 2015

I got the idea about removing and re-adding the drivers (hence the comparison to system-properties), but in this case this approach wouldn't work if I'm not mistaken. The attributes in the resulting tree do not match the attributes supplied to the jdbc-driver:add() statement, so the computed differences would cause it to remove/re-add this over and over again.

I think it's not that big of a deal with most properties of jdbc-driver, save for module-slot.

@bserdar
Copy link
Owner

bserdar commented Jun 8, 2015

The delta is computed using the input configuration file and the current
configuration tree. So, you could build the string passed to :add using
those properties, and as long as the resulting configuration matches the
input file, it should work. I can try this later when I have time, or if
you do, please let me know.

We might need to :reload after removing jdbc driver. It complains that
removed elements are still there until you :reload.

On Mon, Jun 8, 2015 at 12:15 AM, fuero [email protected] wrote:

I got the idea about removing and re-adding the drivers (hence the
comparison to system-properties), but in this case this approach wouldn't
work if I'm not mistaken. The attributes in the resulting tree do not match
the attributes supplied to the jdbc-driver:add() statement, so the computed
differences would cause it to remove/re-add this over and over again.

I think it's not that big of a deal with most properties of jdbc-driver,
save for module-slot.


Reply to this email directly or view it on GitHub
#48 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants