[jboss-as7-dev] "driver-name" attribute while creating the JDBC driver

Jaikiran Pai jpai at redhat.com
Fri Feb 17 05:23:22 EST 2012


I was trying out creation of a JDBC driver through the management 
operation. Initially I used this operation:

[standalone at localhost:9999 /] 
/subsystem=datasources/jdbc-driver=mysql-5-driver:add(driver-module-name=mysql, 
driver-class-name=com.mysql.jdbc.Driver)

Note that it _doesn't_ specify the "driver-name" attribute. However, it 
failed with:

{
     "outcome" => "failed",
     "failure-description" => "JBAS014749: Operation handler failed: No 
child 'driver-name' exists",
     "rolled-back" => true
}

(the error message isn't clear by the way, but that's a different matter).

I then had to change the operation to explicitly specify the driver-name 
attribute:

[standalone at localhost:9999 /] 
/subsystem=datasources/jdbc-driver=mysql-5-driver:add(driver-name=mysql-5-driver, 
driver-class-name=com.mysql.jdbc.Driver, driver-module-name=mysql)

That worked fine.

But why is this operation unlike other "add" operations which use the 
value before the ":" as the name of the new resource? By the way, I even 
tried this command:

[standalone at localhost:9999 /] 
/subsystem=datasources/jdbc-driver=foo:add(driver-name=bar, 
driver-class-name=com.mysql.jdbc.Driver, driver-module-name=mysql)

Note that I use "foo" as the resource name for the add operation and 
"bar" as the driver-name attribute value. This creates a driver named 
"bar" in the standalone.xml:

<driver name="bar" module="mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>

and there's no reference to "foo" anywhere. So what's the significance 
of using it in the operation?

-Jaikiran




More information about the jboss-as7-dev mailing list