Quantcast

How to pass db ip as a var for jdbc con. through cmnd line

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to pass db ip as a var for jdbc con. through cmnd line

ken sogomonov
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to pass db ip as a var for jdbc con. through cmnd line

sebb-2-2
On 27/01/06, ken sogomonov <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...