|
很急的问题请斑竹极其各位同人帮助:
使用FUNCTIONAL TESTER 写出来的脚本如下:
package Public.GetDate;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import resources.Public.GetDate.yyMMddHelper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import oracle.jdbc.driver.OracleDriver;
/**
* Description : Functional Test Script
* @author Administrator
*/
public class yyMMdd extends yyMMddHelper
{
/**
* Script Name : <b>GetDate</b>
* Generated : <b>2006-2-28 10:16:37</b>
* Description : Functional Test Script
* Original Host : WinNT Version 5.1 Build 2600 (S)
*
* @since 2006/02/28
* @author Administrator
*/
public static String staTemp = "";
private String dbname = ""; //"Oracle"
private String ip=""; //"192.2.88.169"
private String dbport =""; //"1521"
private String dbuser = ""; //"orasafe"
private String userid = ""; //"oratest1"
private String userpwd =""; //"oratest1"
private Connection conn = null;
private String sql = "";
private String url = "";
public void testMain(Object[] args)
{
ip= "192.2.88.169";
dbport = "1521";
dbuser = "orasafe";
userid = "oratest1";
userpwd= "oratest1";
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
url ="jdbc:oracle:thin:@192.2.88.169:1521:orasafe";//safedb为你的数据库名
conn= DriverManager.getConnection(url,"oratest1","oratest1");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
sql="select sysdate from dual";
ResultSet rs = stmt.executeQuery(sql);
if(rs.next())
{
java.sql.Date dt = rs.getDate(1);
staTemp = (new java.text.SimpleDateFormat("yyMMdd")).format(dt);
}
}
catch(Exception e)
{
logInfo(e.getMessage());
System.out.println(e.getMessage());
}
}
}
但是在使用TEST MANAGER 进行调用的时候只运行到Class.forName("oracle.jdbc.driver.OracleDriver"); 这就抛出异常,请问是为什么呢,如何解决呢,单独在FUNCTIONAL TESTER中是可以运行的可以取出数据库时间的
请帮助!!!!!!!! |
|