Hi Tran
Please check that this line
uk.org.ogsadai.SQLBulkLoadTuple=uk.org.ogsadai.SQLBulkLoadTuple
is in the file
$CATALINA_HOME/webapps/wsrf/WEB-INF/etc/dai/resources/MySQLDataServiceResource
and check that the lines
id=uk.org.ogsadai.SQLBulkLoadTuple
class=uk.org.ogsadai.activity.sql.SQLBulkLoadTupleActivity
description=
CONFIG
END
are in the file
$CATALINA_HOME/webapps/wsrf/WEB-INF/etc/dai/activities.txt
If either is missing then add then to the file and restart Tomcat.
Cheers,
mike
On Tue, 27
Oct 2009, TRAN THI NGOC MAI wrote:
> Yea! Thanks for your help
> Then, I bulload data from Oracle table to the same table in MySQL.
> But I get this error when I run my code
>
> My code:
> ----------------------------------
> import java.net.URL;
> import java.sql.ResultSet;
> import java.sql.ResultSetMetaData;
> import java.sql.SQLException;
> import uk.org.ogsadai.client.toolkit.presentation.gt.GTDataRequestExecutionResource;
> import uk.org.ogsadai.client.toolkit.DataRequestExecutionResource;
> import uk.org.ogsadai.client.toolkit.DataValueIterator;
> import uk.org.ogsadai.client.toolkit.PipelineWorkflow;
> import uk.org.ogsadai.client.toolkit.RequestExecutionType;
> import uk.org.ogsadai.client.toolkit.RequestResource;
> import uk.org.ogsadai.client.toolkit.Server;
> import uk.org.ogsadai.client.toolkit.presentation.gt.GTServer;
> import
uk.org.ogsadai.client.toolkit.activities.delivery.DeliverToRequestStatus;
> import uk.org.ogsadai.client.toolkit.activities.sql.SQLQuery;
> import uk.org.ogsadai.client.toolkit.activities.transform.TupleToWebRowSetCharArrays;
> import uk.org.ogsadai.resource.ResourceID;
> import uk.org.ogsadai.resource.request.RequestStatus;
> import uk.org.ogsadai.client.toolkit.activities.sql.SQLBulkLoadTuple;
> import org.globus.axis.gsi.GSIConstants;
> import org.globus.wsrf.impl.security.authentication.Constants;
> import org.globus.wsrf.impl.security.authorization.HostAuthorization;
> import org.globus.axis.gsi.GSIConstants;
> import org.globus.wsrf.impl.security.authentication.Constants;
> import org.globus.wsrf.impl.security.authorization.HostAuthorization;
> import org.globus.axis.util.Util;
>
> public class Oracle_to_MySQL
> {
> Â Â Â Â Â Â Â // Register transport level security
> static
> {
> Â Â Â
Util.registerTransport();
> }
>
> public static void main(String[] args) throws Exception
> {Â GTServer mServer1=null;
> Â Â Â DataRequestExecutionResource mDRER1=null;
> Â Â Â ResourceID drerID = new ResourceID("DataRequestExecutionResource");
> Â Â Â ResourceID dataResourceID1 = new ResourceID("DataServiceResource");
> Â Â Â ResourceID dataResourceID2 = new ResourceID("MySQLDataServiceResource");
>
> Â Â Â mServer1 = new GTServer();
> Â Â Â mServer1.setDefaultBaseServicesURL(new URL("https://host1.it.lhu.edu.vn:8443/wsrf/services/dai/"));
> Â Â Â mDRER1 = mServer1.getDataRequestExecutionResource(drerID);
> // Set security
> Â Â Â mDRER1.addServerCommsProperty(
> Â Â Â Constants.GSI_TRANSPORT, Constants.ENCRYPTION);
> Â Â Â mDRER1.addServerCommsProperty(
> Â Â Â Constants.AUTHORIZATION,
HostAuthorization.getInstance());
> Â Â String expression = "SELECT * FROM channels;";
> Â Â Â SQLQuery query = new SQLQuery();
> Â Â Â query.setResourceID(dataResourceID1);
> Â Â Â query.addExpression(expression);
> SQLBulkLoadTuple loadTuples = new SQLBulkLoadTuple();
> Â Â Â loadTuples.setResourceID(dataResourceID2);
> Â Â Â loadTuples.connectDataInput(query.getDataOutput());
> Â Â Â loadTuples.addTableName("CHANNELS");
>
> DeliverToRequestStatus deliverToRequestStatus = new DeliverToRequestStatus();
> deliverToRequestStatus.connectInput(loadTuples.getDataOutput());
>
> // Build the workflow
> PipelineWorkflow pipeline = new PipelineWorkflow();
> pipeline.add(query);
> pipeline.add(loadTuples);
> pipeline.add(deliverToRequestStatus);
>
> RequestResource requestResource =
mDRER1.execute(pipeline,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â RequestExecutionType.SYNCHRONOUS);
> RequestStatus status = requestResource.getRequestStatus();
>
> System.out.println(loadTuples.nextResult());
>
> }
>
> }
> -------------------
>
> My error:
> -----------------
>
>
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â [ugrid1@... mypackage]$ java Oracle_to_MySQL
> Exception in thread "main" uk.org.ogsadai.client.toolkit.exception.RequestErrorException: [1256624974985:3] uk.org.ogsadai.client.toolkit.REQUEST_ERROR : ogsadai-124946c616f
> Â Â Â at uk.org.ogsadai.client.toolkit.resource.BaseDataRequestExecutionResource.checkSynchronousExecutionIsComplete(Unknown Source)
> Â Â Â at uk.org.ogsadai.client.toolkit.resource.BaseDataRequestExecutionResource.execute(Unknown Source)
> Â Â Â at uk.org.ogsadai.client.toolkit.resource.BaseDataRequestExecutionResource.execute(Unknown Source)
> Â Â Â at Oracle_to_MySQL.main(Oracle_to_MySQL.java:89)
> Caused by: uk.org.ogsadai.client.toolkit.exception.ServerMessageException: A user problem has occurred during request processing.
> Â Â Â at uk.org.ogsadai.client.toolkit.exception.RequestErrorException.setCause(Unknown Source)
> Â Â Â at uk.org.ogsadai.client.toolkit.exception.RequestErrorException.<init>(Unknown Source)
> Â Â Â ... 4 more
> Caused by:
uk.org.ogsadai.client.toolkit.exception.ServerMessageException: A user
problem has occured during activity processing.
> Â Â Â ... 6 more
> Caused by:
uk.org.ogsadai.client.toolkit.exception.ServerMessageException: An
activity named uk.org.ogsadai.SQLBulkLoadTuple is not supported by the
resource MySQLDataServiceResource.
> Â Â Â ... 6 more
> ----------------
>
> In the container.log file:
> -----------------
>
> Â Â Â Â Â Â 2009-10-27 13:29:34,864 ERROR drer.SimpleEventfulRequest [pool-2-thread-4,errorExceptionAndChildren:?] #1256624974863:36# A user problem has occurred during request processing.
> 2009-10-27 13:29:34,865 ERROR drer.SimpleEventfulRequest [pool-2-thread-4,errorExceptionAndChildren:?] #1256624974863:36# A user problem has occured during activity processing.
> 2009-10-27 13:29:34,865 ERROR drer.SimpleEventfulRequest [pool-2-thread-4,errorExceptionAndChildren:?] #1256624974863:36# An activity named uk.org.ogsadai.SQLBulkLoadTuple is not supported by the resource MySQLDataServiceResource.
>
> ---------------------
> Â Â Â Â Â Â Â Â Â Â
> I think I import wrong class for the SQLBulkLoadTuple activity
>
> Please, help me!
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
>
>
>
> --- Ngà y Thứ 2, 28/09/09, Mike Jackson <michaelj@...> Äã viết:
>
> Từ: Mike Jackson <michaelj@...>
> Chá»§ Äá»: Re: [ogsa-dai-users] Relational database to database copy using SQL bulk load
> Äến: "TRAN THI NGOC MAI" <ttnmai1979@...>
> Cc: ogsa-dai-users@...
> Ngà y: Thứ Hai, 28 tháng 9, 2009, 4:05
>
>
> Hi
>
> This is a bug in the 3.0 user doc. I've
attached what should be a suitable XSL.
>
> However, these scenarios are examples of how to do things, they're not necessarily the _best_ way to do things. In many cases they're artificial examples designed to demonstrate as many activities as possible.
>
> If you think more about what you're trying to do here you'll see that what the workflow does is this:
>
> SQLQuery
> =>
> TupleToWebRowSetCharArrays
> =>
> XSLTransform
> =>
> CSVToTuple
> =>
> SQLBulkLoadTuple
> =>
> DeliverToRequestStatus
>
> So you go from ResultSet=>Tuple=>WebRowSet=>CSV=>Tuple so you are incurring the overhead of a conversion of tuples to XML to comma-separated values and back to tuples again.
>
> But SQLQuery outputs OGSA-DAI lists of tuples and SQLBulkLoadTuple inputs lists of tuples so you should be able to just do:
>
> SQLQuery => SQLBulkLoadTuple => DeliverToRequestStatus
>
> Cheers,
>
> mike
>
>
> On
Sat, 26 Sep 2009, TRAN THI NGOC MAI wrote:
>
>> Hi all, I have deploy 2 relational resource (Oracle and MySQL). I had one database in Oracle, now I want to copy some data in Oracle database to MySQL database. I think I will do that throught these step:
>> 1. Create all tables in MySQL database same with all tables in Oracle database 2. Using this guid:
>> ---------------
>> 23.10. Executing an SQL query, performing necessary transformations
> and bulk loading another relational resource
> This scenario explores the new dynamics of OGSA-DAI since it shows how
> the results of an SQLQuery against a relational resource can then be
> used to perform a bulk load against another resource that is exposed
> by the OGSA-DAI server.
>
> Between these two activities some transformations need to be
> performed. Initially the output of SQLQuery activity is linked to the
> input of TupleToWebRowSetCharArrays activity. Then this
output passes
> through an XSLTransform activity which will transform the WebRowSet
> into a representation similar to CSV based on a XSL file which is
> provided as a parameter.
>
> String expression = "SELECT id, name, address, phone FROM littleblackbook where id>2 and id<12 order by id";
>> SQLQuery query = new SQLQuery();
>> query.setResourceID(MySQLResource);
>> query.addExpression(expression);
>>
>> TupleToWebRowSetCharArrays tupleToWebRowSet = new TupleToWebRowSetCharArrays();
>> tupleToWebRowSet.connectDataInput(query.getDataOutput());
>>
>> Reader XSLreader = new FileReader("bulkLoad.xsl");
>> XSLTransform xsl = new XSLTransform();
>> xsl.connectXMLInput(tupleToWebRowSet.getResultOutput());
>> xsl.addXSLT(XSLreader);
>>
>
> Followingly, the CSV is transformed into a list of tuples using
> CSVToTuple activity and this list of tuples will then be bulk loaded
> into a
table of another relational resource.
>
> CSVToTuple csvToTuples = new CSVToTuple();
>> csvToTuples.connectDataInput(xsl.getResultOutput());
>> csvToTuples.addHeaderIncluded(true);
>>
>> SQLBulkLoadTuple loadTuples = new SQLBulkLoadTuple();
>> loadTuples.setResourceID(PostgreSQLResource);
>> loadTuples.connectDataInput(csvToTuples.getResultOutput());
>> loadTuples.addTableName(anotherlittleblackbook);
>>
>
> The final part of this scenario involves the execution of the request
> as well as getting the count of bulk loaded tuples through the results
> of SQLBulkLoad activity. To facilitate this we will need to use
> DeliverToRequestStatus activity.
>
> DeliverToRequestStatus deliverToRequestStatus = new DeliverToRequestStatus();
>> deliverToRequestStatus.connectInput(loadTuples.getDataOutput());
>>
>> // Build the workflow
>> PipelineWorkflow pipeline = new
PipelineWorkflow();
>> pipeline.add(query);
>> pipeline.add(tupleToWebRowSet);
>> pipeline.add(xsl);
>> pipeline.add(csvToTuples);
>> pipeline.add(loadTuples);
>> pipeline.add(deliverToRequestStatus);
>>
>> RequestResource requestResource = mDRER.execute(pipeline,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â RequestExecutionType.SYNCHRONOUS);
>> RequestStatus status = requestResource.getRequestStatus();
>> System.out.println(loadTuples.nextResult());
>> -------------------------
>> Is that OK ?
>> But I don't know where is and what is the "bulkLoad.xsl" file.
>> Please, give me some advise!
>>
>> Thanks
>> MAI
>>
>>
>>
>
>
> Â Â Â Yahoo! Mail nay NHANH HÆ N - Thá» ngay! http://vn..mail.yahoo.com
>
> -------------------------------------------------------------------
> Dr. Michael (Mike) Jackson   E-mail: m.jackson@...
> EPCCÂ Â Â Â Â Â Â Â Â Â Â Â Â Â OGSA-DAI Project
> WWW: http://www.epcc.ed.ac.uk WWW: http://www.ogsadai.org.uk
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
> -----Thư ÄÃnh kèm sau Äây-----
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number
SC005336.
>
Äá»a chá» email má»i sẵn có trên Yahoo!
Chá»n ngay má»t tên truy nháºp bạn từng muá»n láºp vá»i tên miá»n má»i ymail và rocketmail. Nhanh nhanh trưá»c khi có ngưá»i xà mất!
-------------------------------------------------------------------
Dr. Michael (Mike) Jackson E-mail: m.jackson@...
OGSA-DAI project EPCC
WWW: http://www.ogsadai.org.uk WWW: http://www.epcc.ed.ac.uk
http://sourceforge.net/projects/ogsa-dai
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
|