Hi Abram - We use Oracle here, and in JMeter the timestamps show up in a normal looking text datetime format.
> 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. For this I just use regular expressions in the response assertion (asserted against the text response.) Regards, Sonam -----Original Message----- From: Abram Catalano [mailto:[EMAIL PROTECTED] Sent: Monday, 7 January 2008 9:16 AM To: JMeter Users List Subject: Re: JDBC response assertions 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 <[EMAIL PROTECTED]> 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. >>> "[EMAIL PROTECTED]" ) >>> >>> 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<Row> 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: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> --------------------------------------------------------------------- >> 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information contained in this email and any attached files are strictly private and confidential. This email should be read by the intended addressee only. If the recipient of this message is not the intended addressee, please call Corporate Express Australia Limited on +61 2 9335 0555 or Corporate Express New Zealand Limited on +64 9 279 2555 and promptly delete this email and any attachments. The intended recipient of this email may only use, reproduce, disclose or distribute the information contained in this email and any attached files with Corporate ExpressÂ’ permission. If you are not the intended addressee, you are strictly prohibited from using, reproducing, disclosing or distributing the information contained in this email and any attached files. Corporate Express advises that this email and any attached files should be scanned to detect viruses. Corporate Express accepts no liability for loss or damage (whether caused by negligence or not) resulting from the use of any attached files. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

