package uk.org.ogsadai.examples.clienttoolkit;
import uk.org.ogsadai.client.toolkit.GenericServiceFetcher;
import uk.org.ogsadai.client.toolkit.Response;
import uk.org.ogsadai.client.toolkit.activity.ActivityRequest;
import uk.org.ogsadai.client.toolkit.activity.sql.SQLQuery;
import uk.org.ogsadai.client.toolkit.activity.sql.WebRowSet;
import uk.org.ogsadai.client.toolkit.service.DataService;
/**
* A simple example of using the client toolkit to run an SQL
* query and return the results in the response to the client
* as WebRowSet.
*
* @author The OGSA-DAI team.
*/
public class HelloWorld {
// Copyright statement
private static final String COPYRIGHT_NOTICE =
"(c) International Business Machines Corporation, 2005. (c) University of Edinburgh 2002 - 2005. ";
public static void main(String[] args) throws Exception {
String handle = "http://localhost:8080/wsrf/services/ogsadai/DataService ";
String id = "MySQLResource ";
DataService service = GenericServiceFetcher.getInstance().getDataService(handle, id);
SQLQuery query =
new SQLQuery( "select * from test ");
WebRowSet rowset = new WebRowSet( query.getOutput() );
ActivityRequest request = new ActivityRequest();
request.add( query );
request.add( rowset );
Response response = service.perform( request );
System.out.println(response.getAsString());
}
}
运行出现如下问题::
Exception in thread "main " java.lang.Error: 无法解析的编译问题:
at HelloWorld.main(HelloWorld.java:18)
Elipse下,一个项目下的这个java文件,导入了,ogsa-core.jar .
似乎问题提示的是 package 这一行,我不知道
package 干什么用, 我的HelloWorld.java文件存储在项目文件夹下。
------解决方法--------------------------------------------------------
觉悟吧,你的第18行有什么,删除了它,为什么在我这里看起来是空行,也许你的特殊字符发到帖子里就过滤掉了
------解决方法--------------------------------------------------------
package uk.org.ogsadai.examples.clienttoolkit;
包的位置是否与存放位置一致?