You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by ken sogomonov <ke...@yahoo.com> on 2006/01/27 03:23:51 UTC
How to pass db ip as a var for jdbc con. through cmnd line
Hello All,
I am having problems passing in the db ip value as an arg through
command line. I am using jmeter 2.1.1
The JDBC Connection Config has the following (and works fine if the
ip address is hardcoded in the "user defined variables" config element
placed above this jdbc connection)
URL: jdbc:microsoft:sqlserver://${db_ip}:1433;
Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
Username: xxx
Pswd: xxx
If I call jmeter through command line
jmeter -n -Jdb_ip=<db ip value> -tTestScript.jmx
It cannot establish a connection. The error is:
"HTTP response message: java.sql.SQLException: [Microsoft][SQLServer
2000 Driver for JDBC]Error establishing socket."
But if I specify the db_ip variable in the user defined variables and
hard code the ip it works fine.
Seems to me that it creates the connection before it even takes in
the variables. Is there a way around this? I really need a way to quickly
switch environments under test.
---------------------------------
Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.
Re: How to pass db ip as a var for jdbc con. through cmnd line
Posted by sebb <se...@gmail.com>.
On 27/01/06, ken sogomonov <ke...@yahoo.com> wrote:
> Hello All,
> I am having problems passing in the db ip value as an arg through
> command line. I am using jmeter 2.1.1
>
> The JDBC Connection Config has the following (and works fine if the
> ip address is hardcoded in the "user defined variables" config element
> placed above this jdbc connection)
>
> URL: jdbc:microsoft:sqlserver://${db_ip}:1433;
> Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
> Username: xxx
> Pswd: xxx
>
> If I call jmeter through command line
> jmeter -n -Jdb_ip=<db ip value> -tTestScript.jmx
${db_ip} is a JMeter variable, not a property. To access properties,
you need to use the __property() function, or for short the __P()
function:
${__P(db_ip)}
You can add a default:
${__P(db_ip,db ip value)}
See:
http://jakarta.apache.org/jmeter/usermanual/functions.html#__P
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org