create or replace PACKAGE BODY UPDATE_RECORD AS
Procedure updateRecord(orderId IN ORDER_CONTEXT.ORDER_ID%TYPE
) IS
BEGIN
update ORDER_CONTEXT
set context_value= (
select to_clob(replace( (context_value).getClobVal(),'xyz','abc'))
from ORDER_CONTEXT where CONTEXT_NAME='IEOD' and ORDER_ID=orderId
)
where CONTEXT_NAME='IEOD' and ORDER_ID=orderId ;
COMMIT;
END updateRecord;
END UPDATE_RECORD;
这是我基于Android s3文档的内容,我试图从照片库中选择图片或从手机拍照并将其上传到S3存储桶并将其恢复到应用程序界面。但是时间我运行程序我的应用程序崩溃了。我叫了
//getting access to the photo gallery
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && data != null) {
Uri selectedImage = data.getData();
uploadImage.setImageURI(selectedImage);
}
Toast.makeText(this, "Test", Toast.LENGTH_LONG).show();
}
//Toast.makeText(this, "Test", Toast.LENGTH_LONG).show();
//Trying to upload image to the AWS S3bucket-
public void uploadImageToAWS(View v) {
//String sdcard = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + "Camera/";
Toast.makeText(this, "Test", Toast.LENGTH_LONG).show();
File MY_FILE = new File("myPhoto.png");
String YOUR_IDENTITY_POOL_ID ="POOL_ID";
CognitoCachingCredentialsProvider credentialsProvider =
new CognitoCachingCredentialsProvider(getApplicationContext(),
YOUR_IDENTITY_POOL_ID,
Regions.US_EAST_1);
AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider);
s3Client.setRegion(Region.getRegion(Regions.US_EAST_1));
TransferUtility transferUtility = new TransferUtility(s3Client,
getApplicationContext());
TransferObserver observer = transferUtility.upload(
"apptestingbucket", // The S3 bucket to upload to
FILE_NAME, // The key for the uploaded object
MY_FILE);// The location of the file to
observer.setTransferListener(new TransferListener() {
@Override
public void onStateChanged(int id, TransferState state) {
if(state == TransferState.COMPLETED){
Toast.makeText(Social.this, "transfer Succeded!", Toast.LENGTH_LONG).show();
}
}
@Override
public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
int percentage = (int) (bytesCurrent/bytesTotal * 100);
Log.e("Status", "Percentage" + percentage);
}
@Override
public void onError(int id, Exception ex) {
Log.e("MY_BUCKET", "Error: " + ex.getMessage() );
}
});
}
private void retrieveImageFromAWS(){
File sdcard = Environment.getExternalStorageDirectory();
File MY_FILE = new File(sdcard, "social.png");
String YOUR_IDENTITY_POOL_ID ="POOL_ID";
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(getApplicationContext(),
YOUR_IDENTITY_POOL_ID
, Regions.US_EAST_1);
AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider);
TransferUtility transferUtility = new TransferUtility(s3Client,
getApplicationContext());
TransferObserver observer = transferUtility.download("BUCKET_NAME",
"FILENAME_TO_BE_DOWNLOADED", MY_FILE);
observer.setTransferListener(new TransferListener() {
@Override
public void onStateChanged(int id, TransferState state) {
if(state == TransferState.COMPLETED){
Toast.makeText(Social.this, "Retrieve completed", Toast.LENGTH_LONG).show();
}
}
@Override
public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
int percentage = (int) (bytesCurrent/bytesTotal * 100);
Log.e("status", "percentage" +percentage);
}
@Override
public void onError(int id, Exception ex) {
Log.e("MY_BUCKET", "Error Downloading: " + ex.getMessage());
}
});
}
加入
uploadImageToAWS(v)
任何示例或小帮助将不胜感激。谢谢!
答案 0 :(得分:0)
尝试检查Android Manifests文件中是否具有使用权限Internet。如果这不起作用,请尝试查看是否可以将应用程序外部的图像(例如,通过命令行)上传到您的存储桶。也许有一些你没有正确设置的安全设置。确保您可以ping服务器并正确设置安全设置。