On 02/06/2008, aidy lewis <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Sorry to bother you again, but I am having problems using the variablised
> data
>
> This is my test plan
>
> test plan
> thread
> JDBC config
> JDBC request
> View Results in Tree
> View Results in Table
> CSV Data Set Config
>
> In my csv data config, I have
>
> filename: C:\data.csv
> variable name: contractId, projectId, partyName
>
> tha data.csv is in this format
> 15004780, Productions 6, 1401
> 15004781, Productions 7, 1402
> 15004782, Productions 8, 1403
> 15004783, Productions 9, 1404
>
> In my jdbc request the sql update is
>
> declare @contractId int,
> @projectId int,
> @partyName nvarchar(100)
>
> set @contractId = ${contractid}
> set @partyName = ${projectId}
> set @projectId = ${partyName}
Looks like the wrong way round.
> and in the jdbc field
>
> parameter values: ${contractid},${projectId}, ${partyName}
> paramater types: int, int, nvarchar
>
> The error I am getting is:
>
> Response message: com.microsoft.sqlserver.jdbc.SQLServerException:
> Line 8: Incorrect syntax near '{'.
You don't need the variable reference in both parameter variables and the SQL
nvarchar types need to be quoted, e.g. '${partyName}' or perhaps using
double-quote - that may depend on your server
> So for some reason, values are not being entered into the variables.
>
Add a Tree View Listener and check the Request pane to see what was sent.
> Aidy
>
> On 02/06/2008, sebb <[EMAIL PROTECTED]> wrote:
> > On 02/06/2008, aidy lewis <[EMAIL PROTECTED]> wrote:
> > > Sebb,
> > >
> > > Thanks. This is valuable information. Is there anyway we can set up a
> > > JMeter Wiki faq, and then we could filter the really useful stuff to
> > > the help files?
> > >
> >
> > There is already a Wiki & FAQ - follow the links on the JMeter web-site.
> >
> > > Aidy
> > >
> > >
> > > On 02/06/2008, sebb <[EMAIL PROTECTED]> wrote:
> > > > On 02/06/2008, aidy lewis <[EMAIL PROTECTED]> wrote:
> > > > > Hi,
> > > > >
> > > > > In a JDBC request, is it possible to use variables in the sql
> query?
> > > > >
> > > > > I have a file
> > > > >
> > > > > 15004781
> > > > > 15004782
> > > > > 15004783
> > > > > 15004784
> > > > > 15004785
> > > > > 15004786
> > > > > 15004787
> > > > > 15004788
> > > > > ....
> > > > >
> > > > > That I read in the CSV data set config. The var has been assigned
> to
> > > > > the name 'contractid'
> > > > >
> > > > > Now, I know I can use this var in Jmeter like this; ${contractid}
> > > > >
> > > > > But, how could I use this in my sql?
> > > > >
> > > > > declare @contractId int,
> > > > >
> > > > > set @contractId = 15004779
> > > > >
> > > >
> > > > If you are referring to SQL in the JDBC sampler, then just put:
> > > >
> > > > set @contractId = ${contractid}
> > > >
> > > > However, I assume you are referring to a stored procedure.
> > > >
> > > > In which case, you need to pass the variable in as a parameter to the
> > > > stored procedure, and use whatever the SQL dialect requires to refer
> > > > to the parameter.
> > > >
> > > > The JDBC Sampler would look something like:
> > > >
> > > > {CALL PROCEDURE(${contractid})}
> > > >
> > > > or, if using a prepared statement:
> > > > {CALL PROCEDURE(?)}
> > > > and then add ${contractid} as a variable at the bottom.
> > > >
> > > > The enclosing {} may not be necessary.
> > > >
> > > > See
> http://jakarta.apache.org/jmeter/usermanual/component_reference.html#JDBC_Request
> > > >
> > > > > Thanks
> > > > >
> > > > > Aidy
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Aidy
> > > www.agiletester.co.uk
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Aidy
> www.agiletester.co.uk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]