jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Shetty <shet...@gmail.com>
Subject Re: How to compare Jmeter results with DB results!
Date Mon, 28 Feb 2011 06:02:05 GMT
You should only need the jdbc jar, but your previous email shows that you
are trying to use a type 2 type of thing with a type 4 driver - i.e. there
are some errors there.

any reason why you cant use a JDBC sampler with type 4?.

If you must write java code , then first get it running standalone ,then jar
it and all related jars into the lib. you should then be able to call your
class from beanshell.

 For beanshell use either print("string"); and run jmeter with
console(jmeter.bat instead of jmeterw) or use the log object to log
statements into the log file

regards
deepak

On Sun, Feb 27, 2011 at 9:31 PM, Ali Navab <sanavab@gmail.com> wrote:

> Dear reader,
> I could run a simple beanshell script in JMeter but about jdbc connection,
> do i need to add special lib into JMeter? except ojdbc that i added it .
> how
> can i trace and debug beanshell code..?
> thnx
>
> On Sat, Feb 26, 2011 at 3:49 PM, Ali Navab <sanavab@gmail.com> wrote:
>
> > Hi All,
> >
> > I need some help using JMeter as Functional testing and compare JMeter
> > results with DB results.
> > I think one of the solutions is using BeanShell Assertion to acquiring
> the
> > DB result into Jmeter variable or csv and then compare it with result
> from
> > webservice (for example ).
> > but i have problem with it .. nothing doing ..
> > i test the beanshell script with "bsh-2.0b4.jar" but with no error doing
> > nothing ..
> > the simple script is:
> > --------------------------------------------------------
> > import java.io.File;
> > import java.sql.DriverManager;
> > import java.sql.SQLException;
> > import java.sql.*;
> > //import org.hsqldb.jdbcDriver;
> > import oracle.jdbc.driver.OracleConnection;
> > import oracle.jdbc.pool.OracleDataSource;
> >
> > out_file = "C:/Program Files/Java/jre6/data/table.csv";
> > db_url = "jdbc:oracle:thin:@
> >
> (description=(address=(host=~~)(protocol=~~)(port=~~))(connect_data=(SERVER=DEDICATED)(sid=ORA8)))";
> > driver = "oracle.jdbc.driver.OracleDriver";
> > user = "~~";
> > password = "~~";
> >
> > sql_statement = "select * from AA;";
> > //sql_statement = "select TABLE_NAME from SYSTEM_TABLES ;";
> >
> > try {
> >
> > Class.forName(driver);
> > Connection con = DriverManager.getConnection(db_url,user,password);
> > Statement stmt = con.createStatement();
> > ResultSet rs = stmt.executeQuery(sql_statement);
> >
> >
> > File out = new File(out_file);
> > FileWriter o = new FileWriter(out);
> >
> > meta = rs.getMetaData();
> > cols = meta.getColumnCount();
> >
> > i = 1;
> > buf = "";
> >
> > while (i <= cols){
> >     if ( i > 1 ) {
> >       buf = buf + ",";
> >     }
> >     buf = buf + meta.getColumnLabel(i);
> >     i = i + 1;
> > }
> > o.write(buf+ "\n");
> > buf = "----------";
> > o.write(buf+ "\n");
> >
> >
> >
> > while (rs.next()) {
> >      ii = 1;
> >      buf = "";
> >      while (ii <= cols){
> >         if ( ii > 1 ) {
> >           buf = buf + ",";
> >         }
> >         col_name_get = meta.getColumnLabel(ii);
> >         buf = buf + rs.getString(col_name_get);
> >         ii = ii + 1;
> >     }
> >     o.write(buf + "\n");
> > }
> > stmt.close();
> > con.close();
> > o.close();
> >
> > } catch ( e ) {
> >     e.printStackTrace();
> > }
> > ---------------------------------------------
> >
> > What should i do ??
> > And how can i store the returned values in an array to compare it easily
> ?
> > one another question is about "Compare Assertion" element and "Comparison
> > Assertion Visualizer" in Jmeter.. what is it for? and how can i use it?
> any
> > manual or help ?
> >
> > Thanks for reading:)
> >
> > Regards,
> > Ali Navab
> >
> >>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message