Skip to main content

Using password alias from command line not working

6 replies [Last post]
markof19
Offline
Joined: 2012-05-30
Points: 0

Hello,

I am trying create connection pool via command line using password alias.

asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --property portNumber=3306:password=${ALIAS=mypasswd}":user=root:serverName=localhost:databaseName=mydtabase --ping MyPool

It creates the pool, but ping will fail because the password alias is not set correctly.

Inspecting from the Web console, the "password" property has the value "mypasswd" instead of "${ALIAS=mypasswd}".

Things will work (ping is ok) if I change the value in the Web console ( to ${ALIAS=mypasswd}.

So is this a bug in the command line ? Or am I typing it it wrong ?

Version : GlassFish Server Open Source Edition 3.1.1 (build 12)

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rdarbh
Offline
Joined: 2011-08-18
Points: 0

Try running list-password-aliases and see if you can even see an Alias called mypasswd.

-bash-3.2$ ./asadmin
Use "exit" to exit and "help" for online help.
asadmin> list-password-aliases
mypwd
Command list-password-aliases executed successfully.
asadmin>
markof19
Offline
Joined: 2012-05-30
Points: 0

I ran the command list-password-aliases , the alias showed.

The problem is not in the password alias.

As mention the previous comment, if I go to the web console and modify the value (registered by by asadmin cmd line) "mypasswd" to "${ALIAS=mypasswd}", everything is OK. I can connect to the DB.

The issue is : Why is asadmin persisting the "password" property as "mypasswd" when I have explicitly specified in my command line as ${ALIAS=mypasswd"} ?

In summary:

1. I executed command line :
sadmin create-jdbc-connection-pool --datasourceclassname
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype
javax.sql.XADataSource --property portNumber=3306:password=${ALIAS=mypasswd}:user=root:serverName=localhost:databaseName=mydtabase --ping MyPool

2. Pool created , ping fails.

3. Check web console : password property is "mypasswd". The value is suppose to be "${ALIAS=mypasswd}" as specified in the command line. (This is the problem)

4. Additional step to show that Alias is OK :- Modified using web console the password property from "mypasswd" to "${ALIAS=mypasswd}". Ping is OK.

tmueller
Offline
Joined: 2005-10-31
Points: 0

Typically when using a shell (if on Unix or Linux) it is necessary to
escape the setting of the property. So the command would be

... --property portNumber=3306:password=\${ALIAS=mypassword}:...

Tom

markof19
Offline
Joined: 2012-05-30
Points: 0

Tried with - ...:passwod=\${ALIAS=mypassword}:...

Eg:
asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype javax.sql.XADataSource --property portNumber=3306:password=\${ALIAS=mypasswd}:user=myuser:server=localhost:database=customer_inventory --ping MyPool

That will just me :

remote failure: Invalid property syntax, "=" in value: password=${ALIAS=mypasswd}Invalid property syntax, "=" in value: password=${ALIAS=mypasswd}

(This is on Linux Bash shell btw...)

Shalini Guest
Offline
Joined: 2011-04-18
Points: 0

Could you use \\ as escape for password=\${ALIAS=mypasswd} ?
Usage : password=\${ALIAS\\=mypasswd}

On Saturday 01 September 2012 01:50 AM, forums@java.net wrote:
> Tried with - ...:passwod=\${ALIAS=mypassword}:... Eg: asadmin
> create-jdbc-connection-pool --datasourceclassname
> com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --restype
> javax.sql.XADataSource --property
> portNumber=3306:password=\${ALIAS=mypasswd}:user=myuser:server=localhost:database=customer_inventory
>
> --ping MyPool That will just me : remote failure: Invalid property
> syntax,
> "=" in value: password=${ALIAS=mypasswd}Invalid property syntax, "=" in
> value: password=${ALIAS=mypasswd} (This is on Linux Bash shell btw...)
>
> --
>
> [Message sent by forum member 'markof19']
>
> View Post: http://forums.java.net/node/889736
>
>

markof19
Offline
Joined: 2012-05-30
Points: 0

Ok, that worked.