Trying to store in Oracle the Filesystem usage
Thanks for helping me with the external table.
I am switching to the other part.
I have df -k | grep -E "u0|orc" >> myfile.txt
I am not sure how to use external table to import it.
i am taking the external table approach because environment here doesn't allow embedded password in clear text. so, i am going the external table route.
thanks.
You have various options of defining the format of a file to be loaded using SQL*Loader (or SQL*Loader via an external table).
You can for example define a fixed file format as oppose to a character separated value format. I suggest that you look at the Oracle® Database Utilities guide.
It goes into great details (with examples) of how to define SQL*Loader control files for loading data, and also covers how the "+external table+" feature works.
Similar Messages
-
What is the best way to resize a JPEG and store it in the Filesystem
Hi All,
I have developped a CMS System that renders JPEGs if it does not have the images available within the desired width already. Within my development setup (Dell Latitude D800 with ubuntu dapper drake) everything works fine and fast, as expected. Then I uploaded the application to my V20Z Server with 4gb RAM and the systems performance goes to its knees. I have hooked in a Java Profiler to see where the problem is, and it showed me that it is hanging wthin
sun.java2d.SunGraphics2D.drawImage(Image, int, int, ImageObserver) which I use to draw my Image to a BufferedImage. Below is my complete source code That I am using. Plus the orofiling results
Do not be confused as I am using the Turbine Framework, which gives me a RawScreen which gives me Access to the HttpServletResponse...
package de.ellumination.carmen.modules.screens;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.Locale;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
import javax.imageio.stream.ImageOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.turbine.modules.screens.RawScreen;
import org.apache.turbine.util.RunData;
import de.ellumination.carmen.om.ImagePeer;
public class Image extends RawScreen
public static final float DEFAULT_COMPRESSION_QUALITY = 1.0F;
* Logger for this class
private static final Logger log = Logger.getLogger(Image.class);
@Override
protected String getContentType(RunData data)
return "image/jpeg";
@Override
protected void doOutput(RunData data) throws Exception
int imageId = data.getParameters().getInt("id");
int width = data.getParameters().getInt("width", -1);
int height = data.getParameters().getInt("height", -1);
HttpServletResponse response = data.getResponse();
de.ellumination.carmen.om.Image image = ImagePeer.retrieveByPK(imageId);
File imgFile = new File(image.getLocation());
if(width > 0 || height > 0)
outputScaledImage(imgFile, response, width, height);
else
outputImage(imgFile, response);
private void outputScaledImage(File imageFile, HttpServletResponse response, int width, int height) throws Exception
File scaledFile = new File(imageFile.getParent() + System.getProperty("file.separator") + width + "_" + imageFile.getName());
if(scaledFile.exists())
outputImage(scaledFile, response);
else
scaleImage(imageFile, scaledFile, width);
outputImage(scaledFile, response);
private void outputImage(File imageFile, HttpServletResponse response) throws Exception
FileInputStream in = new FileInputStream(imageFile);
response.setContentLength((int) imageFile.length());
OutputStream out = response.getOutputStream();
int bSize = 10240;
byte[] buffer = new byte[bSize];
int inBuffer = 0;
while (inBuffer >= 0)
inBuffer = in.read(buffer);
if (inBuffer > 0)
out.write(buffer, 0, inBuffer);
* scales the image to its new size. while scaling the Image, the code first resizes the image using the new Width Parameter.
* If the Image is to high after scaling, it then uses the Images height to determin the scaling Factor.
* @param inputFile the original Image
* @param outputFile the File to store the scaled image to
* @param compressionQuality the compression Quality to use
* @param newWidth the desired images width
* @param newHeight the desired images height
public static void scaleImage(File inputFile, File outputFile, float compressionQuality, int newWidth, int newHeight)
try
if (inputFile.exists())
BufferedImage hiRes = ImageIO.read(inputFile);
double scaleFactor = (double) newWidth / (double) hiRes.getWidth(null);
int tempHeight = (int) (hiRes.getHeight(null) * scaleFactor);
if (tempHeight > newHeight)
scaleFactor = (double) newHeight / (double) hiRes.getHeight(null);
int width = (int) (hiRes.getWidth(null) * scaleFactor);
int height = (int) (hiRes.getHeight(null) * scaleFactor);
scaleImage(outputFile, compressionQuality, hiRes, width, height);
catch (IOException e)
log.error("Unable to create the thumbnail " + outputFile.getAbsolutePath() + " from " + inputFile.getAbsolutePath() + " because of the following Reason.", e);
* scales the image to its new size. while scaling the Image, the code first resizes the image using the new Width Parameter.
* If the Image is to high after scaling, it then uses the Images height to determine the scaling Factor. This method uses the
* default compression quality to store image data.
* @param inputFile the original Image
* @param outputFile the File to store the scaled image to
* @param newWidth the desired images width
* @param newHeight the desired images height
public static void scaleImage(File inputFile, File outputFile, int newWidth, int newHeight)
scaleImage(inputFile, outputFile, DEFAULT_COMPRESSION_QUALITY, newWidth, newHeight);
* scales the image to its new size. while scaling the Image, the code first resizes the image using the new Width Parameter.
* uses the highest image compression quality by default.
* @param inputFile the original Image
* @param outputFile the File to store the scaled image to
* @param compressionQuality the compression Quality of the new Image
* @param newWidth the desired images width
public static void scaleImage(File inputFile, File outputFile, float compressionQuality, int newWidth)
try
if (inputFile.exists())
BufferedImage hiRes = ImageIO.read(inputFile);
double scaleFactor = (double) newWidth / (double) hiRes.getWidth(null);
int width = (int) (hiRes.getWidth(null) * scaleFactor);
int height = (int) (hiRes.getHeight(null) * scaleFactor);
// draw original image to thumbnail image object and
// scale it to the new size on-the-fly
scaleImage(outputFile, compressionQuality, hiRes, width, height);
else
log.error("Unable to create the thumbnail " + outputFile.getAbsolutePath() + " from " + inputFile.getAbsolutePath() + " because inputFile not exists: " + inputFile.getName());
catch (IOException e)
log.error("Unable to create the thumbnail " + outputFile.getAbsolutePath() + " from " + inputFile.getAbsolutePath() + " because of the following Reason.", e);
* scales the image to its new size. while scaling the Image, the code first resizes the image using the new Width Parameter.
* uses the highest image compression quality by default.
* @param inputFile the original Image
* @param outputFile the File to store the scaled image to
* @param newWidth the desired images width
public static void scaleImage(File inputFile, File outputFile, int newWidth)
scaleImage(inputFile, outputFile, DEFAULT_COMPRESSION_QUALITY, newWidth);
* This private method actually scales the inputImage to the desired height, width and compression Quality
* @param outputFile The File in which the Image should be stored.
* @param compressionQuality The Compression Quality to be applied to the image
* @param inputImage the original input Image
* @param width the height of the new Image
* @param height the width of the new Image
* @throws IOException
private static void scaleImage(File outputFile, float compressionQuality, BufferedImage inputImage, int width, int height) throws IOException
BufferedImage lowRes = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
java.awt.Image image = inputImage.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH);
ImageWriter writer = null;
Iterator iter = ImageIO.getImageWritersByFormatName("jpg");
if (iter.hasNext()) writer = (ImageWriter) iter.next();
File outputPath = outputFile.getParentFile();
if (outputPath != null)
if (!outputPath.exists()) outputPath.mkdirs();
lowRes.getGraphics().drawImage(image, 0, 0, null);
ImageOutputStream ios = ImageIO.createImageOutputStream(outputFile);
writer.setOutput(ios);
ImageWriteParam iwparam = new JPEGImageWriteParam(Locale.getDefault());
iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
iwparam.setCompressionQuality(compressionQuality);
// save thumbnail image to OUTFILE
writer.write(null, new IIOImage(lowRes, null, null), iwparam);
writer.dispose();
ios.close();
image.flush();
inputImage.flush();
lowRes.flush();
* scales the image to its new size. while scaling the Image, the code first resizes the image using the new Width Parameter.
* If the Image is to high after scaling, it then uses the Images height to determin the scaling Factor.
* @param inputImage the original Image
* @param outputFile the File to store the scaled image to
* @param compressionQuality the compression Quality to use
* @param newWidth the desired images width
* @param newHeight the desired images height
public static void scaleImage(BufferedImage inputImage, File outputFile, float compressionQuality, int newWidth, int newHeight)
try
double scaleFactor = (double) newWidth / (double) inputImage.getWidth(null);
int tempHeight = (int) (inputImage.getHeight(null) * scaleFactor);
if (tempHeight > newHeight)
scaleFactor = (double) newHeight / (double) inputImage.getHeight(null);
int width = (int) (inputImage.getWidth(null) * scaleFactor);
int height = (int) (inputImage.getHeight(null) * scaleFactor);
scaleImage(outputFile, compressionQuality, inputImage, width, height);
catch (IOException e)
log.error("Unable to create the thumbnail " + outputFile.getAbsolutePath() + " because of the following Reason.", e);
All Threads 702.570 100 %
java.lang.Thread.run() 551.322 78 %
de.ellumination.carmen.modules.screens.Image.doOutput(RunData) 170.666 24 %
de.ellumination.carmen.modules.screens.Image.outputScaledImage(File, HttpServletResponse, int, int) 170.108 24 %
de.ellumination.carmen.modules.screens.Image.scaleImage(File, File, int) 170.108 24 %
de.ellumination.carmen.modules.screens.Image.scaleImage(File, File, float, int) 170.108 24 %
de.ellumination.carmen.modules.screens.Image.scaleImage(File, float, BufferedImage, int, int) 165.787 24 %
sun.java2d.SunGraphics2D.drawImage(Image, int, int, ImageObserver) 165.189 24 %
com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(IIOMetadata, IIOImage, ImageWriteParam) 397 0 %
javax.imageio.ImageIO$ImageWriterIterator.next() 69 0 %
javax.imageio.ImageIO.createImageOutputStream(Object) 47 0 %
java.awt.image.BufferedImage.<init>(int, int, int) 36 0 %
java.awt.Image.getScaledInstance(int, int, int) 23 0 %
java.awt.image.BufferedImage.getGraphics() 21 0 %
javax.imageio.ImageIO.read(File) 4.320 1 %
de.ellumination.carmen.om.BaseImagePeer.retrieveByPK(int) 557 0 %
de.ellumination.carmen.modules.screens.Index.doBuildTemplate(RunData, Context) 1.673 0 %
org.apache.catalina.startup.Bootstrap.main(String[]) 151.225 22 %
org.quartz.core.QuartzSchedulerThread.run() 22 0 %
Now I am looking for the Best way to solve my problem. Maybe I am wrong from the get go.
Runtime Setup Java 1.5.0_04 Tomcat 5.5.12 V20z (AMD64 Opteron 4gb RAM)
Any help is heighly appreciated
Kind regardsThis is a bad thing to do with JPEGs. You're better off just reducing the 'q' if you want a smaller/faster/lower resolution image. That way you're throwing away resolution intelligently. Using scaling you're throwing resolution away unintelligently. I was on a project where 40,000 images were scaled when they should have been low-q'd. Don't do it.
-
Error when trying to store content in the HTTP content server.
I call the FM SDOK_PHIO_STORE_CONTENT to store a document into the pre-configured content server(the server was configured with transaction OAC0 and the connection is tested ok). But the sy-subrc returns 2 (not_allowed). I debugged into this FM and found the specific error is TRANSFER_ERROR in the subroutine STORE_CONTENT.
I have no idea in which situation this error will occur. Anyone can help?
Thank you.Hi Tang,
Though long back, you faced this error.. Any chance you remember the solution for it? Even am facing the same issue. Not able to find a solution for it anywhere. Its getting tough. Your help would be of great helppp...
Many thanks in advance.
Awaiting for your reply, kindly do help me out in this. -
Error while trying to store PDF in Oracle's BLOB field
Hi folks!
I'm having problems while trying to store PDF file in a BLOB field of an Oracle table
This is the message code:
Exception in thread "main" java.sql.SQLException: Data size bigger than max size for this type: 169894
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java:95)
at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:2414)
at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1134)
at oracle.jdbc.driver.OraclePreparedStatement.setBytes(OraclePreparedStatement.java:2170)
at vgoactualizacion.Main.main(Main.java:84)
This is the piece of code i'm using:
Assuming conn = conection to Oracle 10g Database ( it's working )
String miProcedimientoAlmacenado = "{ call package_name.update_client(?,?, ?) }";
CallableStatement miComando = conn.prepareCall(miProcedimientoAlmacenado);
miComando.setString(1,miClienteID ); //first parameter : IN
//second parameter : IN
File miPDF = new File(pathPDF + "//" + miClienteID + ".pdf");
byte[] bodyIn = readFully(miPDF); //readFully procedure is shown below
miComando.setBytes(2, bodyIn); //THIS IS THE LINE WHERE THE ERROR IS PRODUCED
//3rd parameter: OUT
miComando.registerOutParameter(3, java.sql.Types.VARCHAR);
miComando.execute();
private static byte[] readFully(File miPDF) throws FileNotFoundException, IOException {
FileInputStream fis = new FileInputStream(miPDF);
byte[] tmp = new byte[1024];
byte[] data = null;
int sz, len = 0;
while ((sz = fis.read(tmp)) != -1) {
if (data == null) {
len = sz;
data = tmp;
} else {
byte[] narr;
int nlen;
nlen = len + sz;
narr = new byte[nlen];
System.arraycopy(data, 0, narr, 0, len);
System.arraycopy(tmp, 0, narr, len, sz);
data = narr;
len = nlen;
if (len != data.length) {
byte[] narr = new byte[len];
System.arraycopy(data, 0, narr, 0, len);
data = narr;
return data;
}//fin readFully
This approach indicates that the PDF file is converted into an array of bytes, then is stored as binary in the BLOB field.
Thanx in advance, and looking forward for your comments.You will probably need to use the setBinaryStream() method instead of setBytes().
-
I keep getting the message "An unknown error has occurred" when trying to sign in to the App Store. How do I solve this problem?
Make sure you have the correct country selected. Click the round flag icon bottom right side of the App Store window.
-
When trying to log on to the iTunes store I get the message 'We could not complete your iTunes store request. The network connection was reset'. I can access my account on a different PC but not my own. Can you advise me as to what I should do please?
Hello donnafromwakefield,
The article linked below details steps that can help restore your computer's ability to connect to the iTunes Store.
Can't connect to the iTunes Store
http://support.apple.com/en-us/TS1368
Cheers,
Allen -
I live in Australia but when I upgraded to IOS6 it changed my App Store region to the US. How can I change it back? I have been trying to find the answer.
Contact iTunes support & request they clear the balance:
http://www.apple.com/support/itunes/ -
when trying to update apps i keep getting billing method incorrect(this is on iphone 4s) i hsve tried this store,apple id,view id,payment info but does not offer me the none option,i can npt update my phone any ideas anybody please?
If you dont have none option then you must own itunes some money. So you have to enter the payment like a itunes giftcard. you can contact itunes by email by going to expresslane.apple.com
-
I have been trying to download apps from the app store and every time it tells me there is a problem with my previous billing and direct me to put in new billing information and every time i do that it still will not let me download any apps.
Have a look here > http://support.apple.com/kb/TS1646
-
I am trying to store music for two different iPods on the same Windows 8 computer, and when I try and download content from the Cloud I get an error message. Is it possible to have two different Apple IDs on the same computer?
Unfortunately you've discovered too late how important it is to maintain an up-to-date backup of your iTunes library (and all other data of value). You could, before wiping the drive, have considered making use of a commercial data recovery service that could (albeit at considerable cost) have extracted your library from the hard disk, even if virus infected.
In the absence of that option, you will need to restore the content of your library from its original sources:
Depending on your location, you may be able to re-download any iTunes Store purchases that are still available on the Store
Likewise, most digital purchases from Amazon (including auto-rip copies of purchased CDs) should be available from the Amazon Cloud and via the Amazon Music application - the same may be true of other commercial sources for digital downloads
Content imported from your CDs will have to imported again
The specific situation that you describe regarding the music imported from your friend's external HDD suggests that either the source is badly organized and/or originates from a source other than iTunes (other media players may use alternative tags for information like artist, title, album, etc. that are not wholly consistent with how iTunes handle these). Without details of the issues you're seeing it is difficult to suggest a remedy other than going through the media album-by-album, track-by-track, and correcting the inconsistencies.
In the absence of a backup or access to the original library data there is no option other than painstakingly recreating your library as described above. As you do so, you'll now realize how important creating and maintaining backups are - in my case I have at all times three separate duplicates of my library, in two different locations, where none is ever more than a week old compared to the content of my master library. -
I have an Apple ID and trying to sign in for the 1st time on iTunes. When I do, I get the message: "This Apple ID has not been used with the iTunes Store. Please review your account information." When I do, it brings me to the same AppleID login window, and I get stuck in the same loop. I never get to the following screen to enter my account info. What's going on?? This is MADDENING!
If you want to use it, click Review and check your account information. Or you could contact the store support staff if you are concerned at http://www.apple.com/emea/support/itunes/contact.html for further help.
-
Am trying to install apps from the store but each time am getting a message that a newer version of ipad software is required
Settings > General > Software Update
-
Hello, I was trying to purchase an item in a game call 帝王三国! but it does worked first few times, but it isnt working anymore ! It tells me to contact apple store to purchase the item.
Click here and request assistance.
(91679) -
I have a brand new Core i5 Windows 64bit laptop, but cannot connect to the iTunes Sore. I have tried every solution suggested in the discussion groups but I still cannot connect. This includes completely removing all security and firewalls, and I still cannot connect. I have re-load the software in different combinations again to no avail. Any ideas anyone?
Could you walk us through what happens (when you try to connect to the Store) in some more detail, please?
-
I am trying to store my sister's nano library on windows vista p.c. The nano is formatted using a macintosh system. Is there away that I can store the music on window vista?
awoodburn wrote:
Is there a way to get these non-intunes store bought songs into my newly downloaded itunes library?
check out this post by Zevoneer.
Maybe you are looking for
-
Hi Experts, I have a typical situation in the LAB environment. Hope some one helps. I have Installed a SCOM 2012 R2 with SQL 2012 SP1 in a single server (Management group 1). I have installed another management group on another server using this SQL
-
Clicking on Firefox Icon won't open Firefox anymore/ system says Firefox is unsafe
I was in Firefox last night. When I logged out of a gaming site and closed windows I could not reopen Firefox. I had to go back to Zoomtown today to get into the internet.
-
Saving email attachments into Photos
When I'm sent a picture as an email attachment I used to click at the top of the message and it would say "Export to iPhoto". How can I Export to Photos now? It still says "Export to iPhoto". I'm dragging and dropping each one at the moment. Grrrr!
-
Searching for good ASP file upload extension...
Hi. Can anyone recommend a really good ASP/VBScript file upload extension for DW 8.0.2? I've looked everywhere and most of the links on the Exchange are dead, or the companies no longer exist. There are some solutions offered by WebAssist but they on
-
Installing 10.6.8 results in "unknown" error
I am selling my late 2006 24" iMac. Since it has the overheating graphics card that some of you are familiar with, I want to have the software smc fan accelerator installed. At first I uninstalled everything I could and reinstalled the 10.6.8 combo,