We may all know that the ODBC protocol can be recorded. SQL Server 2000 is the underlying protocol, so there are many things we don't want and there are many things, we don't know. so parameterization and maintenance scripts are too difficult .. for this reason, you must useJavaCode to write a testSQLProgram.
/**
LoadRunnerJava SCR limit pt. (Build: 873) * Writer fangtiesui * SCR limit PT descr limit ption: SQL query
Performance TestingScript * Date: 2008-09-19 */import Java. io. *; import lrapi. LR; import Java. SQL. *; public class actions {int sum = 0; Public int Init () throws throwable {return 0;} // end of init public int action () throws throwable {try {string sqldriver = "com. microsoft. JDBC. sqlserver. sqlserverdriver "; Class. forname (sqldriver); system. out. println ("
DatabaseThe driver has been registered! "); String url =" JDBC: Microsoft: sqlserver: // localhost: 1433; databasename = School "; string user =" sa "; string Password =" sa "; string sel = "select * from student where ID> 950"; connection conn = drivermanager. getconnection (URL, user, password); system. out. println ("database connection successful"); LR. start_transaction ("querying student table"); statement sta = Conn. createstatement (); resultset rs = sta.exe cutequery (SEL); system. out. print ("/t" + "ID" + "/t" + "name" + "/t" + "ADDR" + "/t" + "tel" + "/ N "); while (RS. next () {system. out. print ("/t" + Rs. getint (1); system. out. print ("/t" + Rs. getstring (2); system. out. print ("/t" + Rs. getstring (3); system. out. println ("/t" + Rs. getstring (4); sum = sum + 1;} Rs. close (); Sta. close (); Conn. close ();} catch (exception e) {e. printstacktrace (); system. out. println ("test failed");} LR. message ("sum =" + sum); LR. end_transaction ("querying student table", LR. auto); Return 0;} // end of actionpublic int end () throws throwable {return 0;} // end of end}