Return-Path: Delivered-To: apmail-jakarta-jmeter-user-archive@www.apache.org Received: (qmail 87415 invoked from network); 6 Jan 2008 22:16:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jan 2008 22:16:38 -0000 Received: (qmail 63363 invoked by uid 500); 6 Jan 2008 22:16:26 -0000 Delivered-To: apmail-jakarta-jmeter-user-archive@jakarta.apache.org Received: (qmail 62750 invoked by uid 500); 6 Jan 2008 22:16:25 -0000 Mailing-List: contact jmeter-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "JMeter Users List" Reply-To: "JMeter Users List" Delivered-To: mailing list jmeter-user@jakarta.apache.org Received: (qmail 62739 invoked by uid 99); 6 Jan 2008 22:16:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Jan 2008 14:16:25 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [72.32.68.137] (HELO piper.adaptx.com) (72.32.68.137) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Jan 2008 22:16:13 +0000 Received: from [192.168.3.62] (c-67-169-10-247.hsd1.ca.comcast.net [67.169.10.247]) by piper.adaptx.com (Postfix) with ESMTP id 115AF71C5A3 for ; Sun, 6 Jan 2008 16:16:05 -0600 (CST) Message-ID: <47815323.8060309@adaptx.com> Date: Sun, 06 Jan 2008 14:16:03 -0800 From: Abram Catalano User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: JMeter Users List Subject: Re: JDBC response assertions References: <56266436-CA3C-44A3-AF36-DC500FBEE781@adaptx.com> <477EE89D.80408@adaptx.com> <25aac9fc0801060938v907c3b0sac8c1f0d3d53fb8b@mail.gmail.com> In-Reply-To: <25aac9fc0801060938v907c3b0sac8c1f0d3d53fb8b@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Thanks for the response sebb. I still find it hard to believe noone has needed to, say, assert the number of rows returned, or check the value of a specific column. Looks like I'm going to have to amend the JDBC sampler code. I'll start another thread on the dev list to discuss how they'd want it done (if they even want my change). Ideally I think the SampleResult should get the data in _another_ "responseData" field (with the real data being set in it), so as to not break anyone's tests or JMeters assertion code for the current byte[] responseData that is expecting a string. There isn't a problem with the oracle jdbc driver, its just printing what toString() returns. Printing dates and times is always tricky anyways. Thanks, -Abram Catalano sebb wrote: > On 05/01/2008, Abram Catalano wrote: > >> So, digging into the JDBCSampler.java class, I see: >> >> Data data = getDataFromResultSet(rs); >> res.setResponseData(data.toString().getBytes()); >> >> Is there any way to get the "data" object into the "res" (SampleResult) >> object, so I can at least have beanshell access to the columns of the >> result set? >> > > Only by amending the JDBC sampler code. > > Normally toString() produces sensible output. I don't recall ever > seeing output such as you describe, but then I've only used Derby and > MySql. Not sure if the test databases I used had date columns. > > Maybe there is a problem with the Oracle JDBC driver? > > Might be worth checking if the same behaviour occurs with other > databases and timestamps. > > >> Full example below: >> >> public SampleResult sample(Entry e) { >> ...... >> >> if (SELECT.equals(_queryType)) { >> stmt = conn.createStatement(); >> ResultSet rs = null; >> try { >> rs = stmt.executeQuery(getQuery()); >> Data data = getDataFromResultSet(rs); >> res.setResponseData(data.toString().getBytes()); >> } finally { >> close(rs); >> } >> } >> .... >> } >> >> How has noone else needed this? >> >> Thanks in advance, >> -Abram >> >> >> Abram Catalano wrote: >> >>> Apologies in advance if this is obvious. I crawled google and the >>> archives and didn't see what I needed. >>> >>> I have a JDBC sampler set up, and I want to make some assertions on >>> the rows' data returned. I see that I can dump the JDBC response to a >>> file, and then subsequently iterate over the file, but that is not >>> getting me far enough. >>> >>> 1) I dont really want to use a file, I just want to iterate over the >>> jdbc reponse in memory. They're small responses (a few rows). how? >>> 2) One issue I am having is that some of the rows contain timestamps. >>> It appears any response data I see is "toString()"ing the data, so >>> timestamps just appear as their Java class/mem address (e.g. >>> "oracle.sql.TIMESTAMP@1bb9f3f" ) >>> >>> Is there some way to provide a row object (and some mapping code, >>> something like Spring's JdbcTemplate provides), and be able to iterate >>> over a list of row objects? I need to do things like see if a >>> timestamp is within +- 5 seconds of what it should be. >>> >>> I haven't looked at BeanShell much yet. I'd prefer some simple Java >>> code that validates/tests JDBC response data. (e.g. boolean >>> verify(List response) ) >>> >>> Also, if there is an easy extension point for JDBC response processing >>> (that takes a ResultSet as an argument), I'd be interested in writing >>> up some code to help out in this area. >>> >>> Thanks in advance. >>> -Abram >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org >>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: jmeter-user-help@jakarta.apache.org