users@glassfish.java.net

how to use asadmin create jdbc-resource that has more than 1 target cluster

From: <glassfish_at_javadesktop.org>
Date: Wed, 07 Jul 2010 09:16:03 PDT

Hi,

We would like to use asadmin to create a jdbc-resource that has more than one target cluster. According to SGCS 2.0 Reference Manual:

create-jdbc-resource- creates a JDBC resource with the specified JNDI name

[...]

--target This option helps specify the target on which you are creating the JDBC resource. Valid values are:

server- Specifies the default server instance as the target for creating the JDBC resource. server is the name of the default server instance and is the default value.
domain- Specifies a particular domain as the target for creating the JDBC resource.
cluster_name- Specifies a particular cluster as the target for creating the JDBC resource.
instance_name- Specifies a particular instance as the target for creating the JDBC resource.

I cannot see how I could specify more than one cluster in the asadmin. But using the SGCS Admin GUI, it is possible to add more targets to a JDBC Resource (Resources > JDBC > JDBC Resources > jdbc/MyJdbcPool > Target). Is there any way to create multiple targets or add targets programmatically in the CLI?

I have tried to run the asadmin twice with different cluster. I got duplicate resource error.

# /opt/sailfin/bin/asadmin.sun create-jdbc-resource --host das --port 4848 --user admin --passwordfile /home/user/password.dat --connectionpoolid MyJdbcDefaultPool --target oam jdbc/MyDefaultPool
Command create-jdbc-resource executed successfully.

# /opt/sailfin/bin/asadmin.sun create-jdbc-resource --host das --port 4848 --user admin --passwordfile /home/mmas/password.dat --connectionpoolid MyJdbcDefaultPool --target traffic jdbc/MyDefaultPool
JdbcResource already exists: cannot add duplicate
CLI137 Command create-jdbc-resource failed.

If I add the 2 clusters "oam" and "traffic" in the same line of asadmin command, it simply says the syntax is wrong.

Regards,

//Qiang Fan
[Message sent by forum member 'qiangfan']

http://forums.java.net/jive/thread.jspa?messageID=477018