Exception while doing bulk insertion
Hi,
I am trying to do a bulk insert of records into a table using my application. I am using prepared statement to achieve this. I am getting the following exception while doing bulk insert.
java.lang.NegativeArraySizeException
I am using SQL Server driver version 2000.80.380.00 for this. The database type chosen is JDBC-ODBC.
Your early response is appreciated.
Regards
Ramesh
Hi,
I am trying to do a bulk insert of records into a
table using my application. I am using prepared
statement to achieve this. I am getting the following
exception while doing bulk insert.
java.lang.NegativeArraySizeException
I am using SQL Server driver version 2000.80.380.00
for this. The database type chosen is JDBC-ODBC.
Your early response is appreciated.
RegardsLooks like one of your arrays has a problem with its size, possibly a negative size!
It could be a problem...
somewhere...
in your application...
in the code...
somewhere.
Possibly at the line number indicated by the exception... just a wild guess!
Thought about looking for it? Thats what I'd do first.
Or do you expect someone to say "Ahhhhh 2000.80.380.00 marvelous plumage, bugger with the bulk inserts"
Similar Messages
-
SendScenarioEvent throwing exception while doing AddToCart
Hi
I am getting the following exception while doing an addToCart.
21:03:53,678 ERROR [CartFormHandler]
CAUGHT AT:
CONTAINER:atg.commerce.CommerceException: error adding to order; SOURCE:CONTAINER:atg.service.pipeline.RunProcessException: An exception was thrown fr
om the context of the link named [sendMessage].; SOURCE:java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnota
llowed] [com.arjuna.ats.internal.jta.transaction.arjunacore.syncsnotallowed] Synchronizations are not allowed! Transaction status isActionStatus.ABORT
_ONLY
at com.xxx.commerce.order.purchase.XPurchaseProcessHelper.addItemsToOrder(XPurchaseProcessHelper.java:127)
While debugging the code i see that the commerce items are getting created fine, but when the "runProcessSendScenatioEvent" is being called its throwing this exception.
If i comment this piece of code then i dont get any exception but then i dont see a commerce item in the cart.
Any help is appreciated.Thanks Gautam!
i switched on the logs for PurchaseProcessHelper and found the following
02:06:45,525 INFO [PurchaseProcessHelper] DEBUG runProcess called with chain ID = repriceOrder
02:06:45,526 INFO [PurchaseProcessHelper] DEBUG PipelineError: key=PriceOrderTotalError; error=No price could be found in priceList listPrices for pr
oduct p25059 and sku 25059
02:06:45,526 INFO [PurchaseProcessHelper] DEBUG runProcess called with chain ID = sendScenarioEvent
But i can see the price for the sku 25059 in the listPrices pricelist.
I am not sure why it is throwing this error.
So all i m doing is creating a configurableCommerceItem and adding a SubSkuCommerceItem to it, and then the OOB chains are getting called.
I have debugged the code and dont find any errors in creating of commerce item or the sub sku commerce item.
If i comment the "runProcessRepriceOrder" chain then the commerce item and subsku commerce item are getting generated fine and i can see it in the order in ACC. -
OM vision India Hyderabad---exception while doing the ship confirm
order management vision India Hyderabad ----we are getting the exception while doing the ship confirm the exceptions are shown below:
Order: 20041 customer: C2il_customer Item: XXBikeEngine Error: NO DATA FOUND
Order: 20041 customer: C2il_customer Item: XXBikeEngine Error: NO DATA FOUND Transactions window: Pick and ship
Errors
Warning: Item on delivery detail 3962489 does not have pre-specified weight and volume.
Warning: Delivery 3773383 has null Weight
Error: Bill of Lading Number could not be generated because the ship method code was not selected for the trip 3129358.
Warning: Bill of Lading information could not be automatically created for delivery 3773383.
Submitted 4 out of 4 documents for this document set. (REQ_IDS=5807692, 5807693, 5807694, 5807695)
Warning: Failed to submit document set for delivery 3773383
Warning: 1 deliveries will be marked as Confirmed.
Warning: Some deliveries selected for Ship Confirm have errors or warnings.
i am grateful if any one can provide suggestion on the issue.....Can you please share the documents and suggestions for R12Have you reviewed all the docs referenced above?
actually all are working fine in normal vision operations,and we are facing the exceptions while we are doing in OM vision India Hyderabad.
is there any setups do we configured for the OM vision India Hyderabad.if you can share any information on that it will be helpful...If the docs referenced above and Oracle Documentation http://download.oracle.com/docs/cd/B53825_08/current/html/docset.html do not help, then I would suggest you log a SR.
Thanks,
Hussein -
Error while doing an INSERT or an UPDATE to the DB(MS Access)
I get the following error while inserting or updating the database (MS Access in my case). However, the record does get inserted or updated. Please advice. I just want to get rid of the error to utilize my form.
Error :ado2xfa operation failed. It, cannot be found in the collection corressponding to the requested name or ordinal
Thanks.If you mean fix it, by continuing to use an insert statement and not have the error appear, then no. The best you can do is catch the error and ignore it and hope this continues to work in the future.
The way not to get the error would be to use the addNew() and update() methods of the data connection, where the values in the bound fields would be updated in the DB.
Chris
Adobe Enterprise Developer Support -
Error while running bulk insert in SSIS package
Hi:
I have an error when I am running bulk insert in SSIS package.
I have implemented an SSIS package to update master data directly from R/3, R/3 gives the file in a specified format, I take this and insert all the records into a temporary table and then update mbr table and process the dimension.
This works perfectly well in our development system where both our app server and sql server on the same box. But in QAS, the 2 servers are separate and when I try to run the SSIS package I get the below error.
We have tested all connections and are able to access the path and file from both app server and sql server using the shared folder. Our basis team says that it is a problem with bulk insert task and nothing to do with any authorization.
Has anyone experienced with this sort of problem in multi server environment? Is there another way to load all data from a file into bespoke table without using bulk insert.
Thanks,
Subramania
Error----
SSIS package "Package.dtsx" starting.
Error: 0xC002F304 at Insert Data Into Staging Table (Account), Bulk Insert Task: An error occurred with the following error message: "Cannot bulk load because the file "
msapbpcapq01\dim\entity.csv" could not be opened. Operating system error code 5(Access is denied.).".
Task failed: Insert Data Into Staging Table (Account)
SSIS package "Package.dtsx" finished: Success.
The program '[2496] Package.dtsx: DTS' has exited with code 0 (0x0).Hi Subramania
From your error:
Error: 0xC002F304 at Insert Data Into Staging Table (Account), Bulk Insert Task: An error occurred with the following error message: "Cannot bulk load because the file "
msapbpcapq01\dim\entity.csv" could not be opened. Operating system error code 5(Access is denied.).".
Let say, server A is where the file entity.csv is located
Please check the Event Viewer->Security of Server A at the time when the SSIS run, there must be an entry with Logon Failure and find what user was used to access the shared path.
If your both servers are not in a domain, create the user in server A with the same name and password and grant read access to the shared folder.
The other workaround is grant read access to Everybody on the shared folder.
Halomoan
Edited by: Halomoan Zhou on Oct 6, 2008 4:23 AM -
File access problem while using BULK INSERT
I'm creating a script to automatically convert a large mess of data. Here's a test query I was using to bring a file into the database:
INSERT [ImportTestTable]
SELECT a.*
FROM
OPENROWSET(
BULK 'D:\TestFile.csv',
FORMATFILE = 'D:\TestStyle.fmt',
FIRSTROW = 2
) AS a;
SELECT * FROM ImportTestTable
I've used queries like this on other networks and machines before, but when I run that query on the particular machine I'm working with now, I get the following error:
Msg 4861, Level 16, State 1, Line 13
Cannot bulk load because the file "D:\TestFile.csv" could not be opened. Operating system error code 21
(The device is not ready.).
Here's some relevant facts I can think of that might help:
I am running the query from SQL Server Management Studio on a remote machine running Windows 7 Ultimate. I am connected to this server using SQL authentication. I believe we are on the same domain / network. I am not the DBA. I do
have the permission "Administer Bulk Operations" explicitly granted to me by the DBA. The user I am currently logged in as in windows is capable of opening, editing, and saving the file in windows explorer. The format file is a NON-XML
format file.
Any pointers as to where to look for more detailed information would be greatly appreciated!I know this is a little old by now, but this is what I used just this week:
bulk insert [dbo].[Test_Table]
from 'C:\Documents and Settings\rshuell\Desktop\Test_File.txt'
WITH (
FIELDTERMINATOR=',',
ROWTERMINATOR = '\n',
KEEPNULLS,
FIRSTROW=2
That worked fine for me.
Of course, we Naomi stated, the file has to be ON THE SERVER. Or, if you're using an FTP site, for instance, the path would have to point to the FTP site.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
Error while doing Bulk Collect to a table type
I'm using a Table type to accumulate resultset from a loop and finally return the records in the table type as a ref cursor to the front end.
But when I'm using Bult collect to insert into the table type object it keeps throwing an error
'PLS-00597: expression 'TAB_CALENDAR_AVAIL_RESULTSET' in the INTO list is of wrong type'. Can someone help me to let me know what could be the reason for this error. I'm not able to proceed further, please help.
Here is the code.
CREATE OR REPLACE PACKAGE hotel
AS
TYPE calendar_cursor IS REF CURSOR;
TYPE type_calendar_avail is RECORD(
HOTEL_ID AVAILABILITY_CALENDAR.hotel_id%TYPE,--varchar2(4), --AVAILABILITY_CALENDAR.hotel_id%TYPE,
AVAIL_DATE AVAILABILITY_CALENDAR.AVAIL_DATE%TYPE ,
TOTAL_COUNT number
TYPE type_calendar_avail_resultset IS TABLE OF type_calendar_avail;
tab_calendar_avail_resultset type_calendar_avail_resultset ; -- declare variable of type type_calendar_avail_resultset
PROCEDURE sp_get_calendar_results (
sallhotelswithavaildate VARCHAR2,
ilengthofstay NUMBER,
sorcowner VARCHAR2,
all_unittypes VARCHAR2, --DBMS_SQL.VARCHAR2S
calendar_resultset OUT calendar_cursor
-- tab_calendar_avail_resultset out type_calendar_avail_resultset
PROCEDURE sp_get_calendar_results (
sallhotelswithavaildate VARCHAR2,
ilengthofstay NUMBER,
-- ivariant NUMBER,
sorcowner VARCHAR2,
all_unittypes VARCHAR2, --DBMS_SQL.VARCHAR2S
calendar_resultset OUT calendar_cursor
AS
sbuf VARCHAR2 (200);
sepr VARCHAR2 (1);
shotelwithdate VARCHAR2 (200);
shotelid VARCHAR2 (10);
savaildate VARCHAR2 (8);
sactualavaildate VARCHAR2 (8);
pos NUMBER;
istart NUMBER;
sstartdate VARCHAR2 (8);
senddate VARCHAR2 (8);
squery VARCHAR2 (32767) := '';
sunittypecond VARCHAR2 (500) := '';
sunitdesccond VARCHAR2 (500) := '';
v_unit_cond a_unit_cond;
tempunitcond VARCHAR2 (50) := '';
BEGIN
istart := 1;
LOOP
tempunitcond := hotel.stringtokenizer (all_unittypes, istart, '|');
IF tempunitcond IS NOT NULL
THEN
v_unit_cond (istart) := tempunitcond;
istart := istart + 1;
END IF;
EXIT WHEN tempunitcond IS NULL;
END LOOP;
sunitdesccond := hotel.get_unit_description_cond (v_unit_cond);
DBMS_OUTPUT.put_line ('unit description : ' || sunitdesccond);
sbuf := sallhotelswithavaildate;
sepr := '|';
istart := 1;
LOOP
shotelwithdate := hotel.stringtokenizer (sbuf, istart, sepr);
EXIT WHEN shotelwithdate IS NULL;
shotelid :=
SUBSTR (shotelwithdate, 1, INSTR (shotelwithdate, ',') - 1);
savaildate :=
SUBSTR (shotelwithdate, INSTR (shotelwithdate, ',') + 1);
squery :=
' SELECT MIN (ad.avail_date) '
|| ' FROM wvo_fonres.fpavail_daily ad'
|| ' WHERE ad.hotel_id = '
|| shotelid
|| ' AND ad.days_left >= '
|| ilengthofstay
|| ' AND ad.avail_date >= '
|| savaildate;
IF UPPER (sorcowner) = 'N'
THEN
squery :=
squery
|| ' AND ad.ORC_TYPE != ''R'' and ad.ORC_TYPE != ''P'' and ad.ORC_TYPE != ''E'' ';
END IF;
squery := squery || ' AND ( ' || sunitdesccond || ') ';
EXECUTE IMMEDIATE squery
INTO sactualavaildate;
DBMS_OUTPUT.put_line ('Actual available Date: ' || sactualavaildate);
hotel.sp_get_startdate_enddate (sactualavaildate,
--ivariant,
sstartdate,
senddate
sunittypecond := hotel.get_unittype_cond (v_unit_cond, sorcowner);
-- execute immediate
squery :=
'select HOTEL_ID, AVAIL_DATE, ' || sunittypecond || ' AS TOTAL_COUNT '
|| ' FROM AVAILABILITY_CALENDAR A '
|| 'WHERE '
|| 'AVAIL_DATE >= '''
|| sstartdate
|| ''' '
|| 'AND '
|| 'AVAIL_DATE <= '''
|| senddate
|| ''' '
||'AND '
|| 'A.HOTEL_ID IN ('
|| shotelid
|| ') '
|| 'AND ('
|| sunittypecond
|| '> 0) '
|| -- where total available count of unit type is greater than 0
' ORDER BY AVAIL_DATE'; --order clause
open calendar_resultset for squery;
fetch calendar_resultset BULK COLLECT INTO tab_calendar_avail_resultset;
istart := istart + 1;
END LOOP;
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
(SQLERRM (SQLCODE));
RAISE;
END sp_get_calendar_results;
END hotel;
/1. put tags [co[/b][b]de] and [co[/b][b]de] around your code, so it's readable
B. what does "hotel.get_unittype_cond (v_unit_cond, sorcowner)" actually retun?
and third, try this for the array declaration:
tab_calendar_avail_resultset type_calendar_avail_resultset := type_calendar_avail_resultset ; () ; -
StringIndexOutofBounds Exception while doing FTP operation
Hello, I got this exception at run time when I am doing my FTP operations
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:455)
at FTPConnection.getFullServerReply(FTPConnection.java:312)
at FTPConnection.getServerReply(FTPConnection.java:296)
at FTPConnection.executeCommand(FTPConnection.java:329)
at FTPConnection.login(FTPConnection.java:107)
at JEditor$FTPUpload.checkTF(JEditor.java:2755)
at JEditor$FTPUpload.actionPerformed(JEditor.java:2783)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
67)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1820)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:419)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:258)
at java.awt.Component.processMouseEvent(Component.java:5021)
at java.awt.Component.processEvent(Component.java:4818)
at java.awt.Container.processEvent(Container.java:1380)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1437)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
at java.awt.Container.dispatchEventImpl(Container.java:1423)
at java.awt.Window.dispatchEventImpl(Window.java:1566)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:190)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
The file that I used for my FTP is
* File: FTPConnection.java
* Author: Bret Taylor <[email protected]>
* $Id$
* Parts of this code were adopted from a variety of other FTP classes the
* author has encountered that he was not completely satisfied with. If you
* think more thanks are due to any particular author than is given, please
* let him know. With that caveat, this class can be freely distributed and
* modified as long as Bret Taylor is given credit in the source code comments.
import java.io.*;
import java.net.*;
import java.util.*;
* <p>A wrapper for the network and command protocols needed for the most common
* FTP commands. Standard usage looks something like this:</p>
* <pre> FTPConnection connection = new FTPConnection();
* try {
* if (connection.connect(host)) {
* if (connection.login(username, password)) {
* connection.downloadFile(serverFileName);
* connection.uploadFile(localFileName);
* connection.disconnect();
* } catch (UnknownHostException e) {
* // handle unknown host
* } catch (IOException e) {
* // handle I/O exception
* }</pre>
* <p>Most FTP commands are wrapped by easy-to-use methods, but in case clients
* need more flexibility, you can execute commands directly using the methods
* executeCommand and
* executeDataCommand,
* the latter of which is used for commands that require an open data port.</p>
* @author Bret Taylor
* @version 1.0
public class FTPConnection extends Object {
* If this flag is on, we print out debugging information to stdout during
* execution. Useful for debugging the FTP class and seeing the server's
* responses directly.
private static boolean PRINT_DEBUG_INFO = false;
* Connects to the given FTP host on port 21, the default FTP port.
public boolean connect(String host)
throws UnknownHostException, IOException
return connect(host, 21);
* Connects to the given FTP host on the given port.
public boolean connect(String host, int port)
throws UnknownHostException, IOException
connectionSocket = new Socket(host, port);
outputStream = new PrintStream(connectionSocket.getOutputStream());
inputStream = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
if (!isPositiveCompleteResponse(getServerReply())){
disconnect();
return false;
return true;
* Disconnects from the host to which we are currently connected.
public void disconnect()
if (outputStream != null) {
try {
outputStream.close();
inputStream.close();
connectionSocket.close();
} catch (IOException e) {}
outputStream = null;
inputStream = null;
connectionSocket = null;
* Wrapper for the commands <code>user [username]</code> and <code>pass
* [password]</code>.
public boolean login(String username, String password)
throws IOException
int response = executeCommand("user " + username);
if (!isPositiveIntermediateResponse(response)) return false;
response = executeCommand("pass " + password);
return isPositiveCompleteResponse(response);
* Wrapper for the command <code>cwd [directory]</code>.
public boolean changeDirectory(String directory)
throws IOException
int response = executeCommand("cwd " + directory);
return isPositiveCompleteResponse(response);
* Wrapper for the commands <code>rnfr [oldName]</code> and <code>rnto
* [newName]</code>.
public boolean renameFile(String oldName, String newName)
throws IOException
int response = executeCommand("rnfr " + oldName);
if (!isPositiveIntermediateResponse(response)) return false;
response = executeCommand("rnto " + newName);
return isPositiveCompleteResponse(response);
* Wrapper for the command <code>mkd [directory]</code>.
public boolean makeDirectory(String directory)
throws IOException
int response = executeCommand("mkd " + directory);
return isPositiveCompleteResponse(response);
* Wrapper for the command <code>rmd [directory]</code>.
public boolean removeDirectory(String directory)
throws IOException
int response = executeCommand("rmd " + directory);
return isPositiveCompleteResponse(response);
* Wrapper for the command <code>cdup</code>.
public boolean parentDirectory()
throws IOException
int response = executeCommand("cdup");
return isPositiveCompleteResponse(response);
* Wrapper for the command <code>dele [fileName]</code>.
public boolean deleteFile(String fileName)
throws IOException
int response = executeCommand("dele " + fileName);
return isPositiveCompleteResponse(response);
* Wrapper for the command <code>pwd</code>.
public String getCurrentDirectory()
throws IOException
String response = getExecutionResponse("pwd");
StringTokenizer strtok = new StringTokenizer(response);
// Get rid of the first token, which is the return code
if (strtok.countTokens() < 2) return null;
strtok.nextToken();
String directoryName = strtok.nextToken();
// Most servers surround the directory name with quotation marks
int strlen = directoryName.length();
if (strlen == 0) return null;
if (directoryName.charAt(0) == '\"') {
directoryName = directoryName.substring(1);
strlen--;
if (directoryName.charAt(strlen - 1) == '\"')
return directoryName.substring(0, strlen - 1);
return directoryName;
* Wrapper for the command <code>syst</code>.
public String getSystemType()
throws IOException
return excludeCode(getExecutionResponse("syst"));
* Wrapper for the command <code>mdtm [fileName]</code>. If the file does
* not exist, we return -1;
public long getModificationTime(String fileName)
throws IOException
String response = excludeCode(getExecutionResponse("mdtm " + fileName));
try {
return Long.parseLong(response);
} catch (Exception e) {
return -1L;
* Wrapper for the command <code>size [fileName]</code>. If the file does
* not exist, we return -1;
public long getFileSize(String fileName)
throws IOException
String response = excludeCode(getExecutionResponse("size " + fileName));
try {
return Long.parseLong(response);
} catch (Exception e) {
return -1L;
* Wrapper for the command <code>retr [fileName]</code>.
public boolean downloadFile(String fileName)
throws IOException
return readDataToFile("retr " + fileName, fileName);
* Wrapper for the command <code>retr [serverPath]</code>. The local file
* path to which we will write is given by <code>localPath</code>.
public boolean downloadFile(String serverPath, String localPath)
throws IOException
return readDataToFile("retr " + serverPath, localPath);
* Wrapper for the command <code>stor [fileName]</code>.
public boolean uploadFile(String fileName)
throws IOException
return writeDataFromFile("stor " + fileName, fileName);
* Wrapper for the command <code>stor [localPath]</code>. The server file
* path to which we will write is given by <code>serverPath</code>.
public boolean uploadFile(String serverPath, String localPath)
throws IOException
return writeDataFromFile("stor " + serverPath, localPath);
* Set the restart point for the next download or upload operation. This
* lets clients resume interrupted uploads or downloads.
public void setRestartPoint(int point)
restartPoint = point;
debugPrint("Restart noted");
* Gets server reply code from the control port after an ftp command has
* been executed. It knows the last line of the response because it begins
* with a 3 digit number and a space, (a dash instead of a space would be a
* continuation).
private int getServerReply()
throws IOException
return Integer.parseInt(getFullServerReply().substring(0, 3));
* Gets server reply string from the control port after an ftp command has
* been executed. This consists only of the last line of the response,
* and only the part after the response code.
private String getFullServerReply()
throws IOException
String reply;
do {
reply = inputStream.readLine();
debugPrint(reply);
} while(!(Character.isDigit(reply.charAt(0)) &&
Character.isDigit(reply.charAt(1)) &&
Character.isDigit(reply.charAt(2)) &&
reply.charAt(3) == ' '));
return reply;
* Executes the given FTP command on our current connection, returning the
* three digit response code from the server. This method only works for
* commands that do not require an additional data port.
public int executeCommand(String command)
throws IOException
outputStream.println(command);
return getServerReply();
* Executes the given FTP command on our current connection, returning the
* last line of the server's response. Useful for commands that return
* one line of information.
public String getExecutionResponse(String command)
throws IOException
outputStream.println(command);
return getFullServerReply();
* Executes the given ftpd command on the server and writes the results
* returned on the data port to the file with the given name, returning true
* if the server indicates that the operation was successful.
public boolean readDataToFile(String command, String fileName)
throws IOException
// Open the local file
RandomAccessFile outfile = new RandomAccessFile(fileName, "rw");
// Do restart if desired
if (restartPoint != 0) {
debugPrint("Seeking to " + restartPoint);
outfile.seek(restartPoint);
// Convert the RandomAccessFile to an OutputStream
FileOutputStream fileStream = new FileOutputStream(outfile.getFD());
boolean success = executeDataCommand(command, fileStream);
outfile.close();
return success;
* Executes the given ftpd command on the server and writes the contents
* of the given file to the server on an opened data port, returning true
* if the server indicates that the operation was successful.
public boolean writeDataFromFile(String command, String fileName)
throws IOException
// Open the local file
RandomAccessFile infile = new RandomAccessFile(fileName, "r");
// Do restart if desired
if (restartPoint != 0) {
debugPrint("Seeking to " + restartPoint);
infile.seek(restartPoint);
// Convert the RandomAccessFile to an InputStream
FileInputStream fileStream = new FileInputStream(infile.getFD());
boolean success = executeDataCommand(command, fileStream);
infile.close();
return success;
* Executes the given ftpd command on the server and writes the results
* returned on the data port to the given OutputStream, returning true
* if the server indicates that the operation was successful.
public boolean executeDataCommand(String command, OutputStream out)
throws IOException
// Open a data socket on this computer
ServerSocket serverSocket = new ServerSocket(0);
if (!setupDataPort(command, serverSocket)) return false;
Socket clientSocket = serverSocket.accept();
// Transfer the data
InputStream in = clientSocket.getInputStream();
transferData(in, out);
// Clean up the data structures
in.close();
clientSocket.close();
serverSocket.close();
return isPositiveCompleteResponse(getServerReply());
* Executes the given ftpd command on the server and writes the contents
* of the given InputStream to the server on an opened data port, returning
* true if the server indicates that the operation was successful.
public boolean executeDataCommand(String command, InputStream in)
throws IOException
// Open a data socket on this computer
ServerSocket serverSocket = new ServerSocket(0);
if (!setupDataPort(command, serverSocket)) return false;
Socket clientSocket = serverSocket.accept();
// Transfer the data
OutputStream out = clientSocket.getOutputStream();
transferData(in, out);
// Clean up the data structures
out.close();
clientSocket.close();
serverSocket.close();
return isPositiveCompleteResponse(getServerReply());
* Transfers the data from the given input stream to the given output
* stream until we reach the end of the stream.
private void transferData(InputStream in, OutputStream out)
throws IOException
byte b[] = new byte[1024]; // 1K blocks I guess
int amount;
// Read the data into the file
while ((amount = in.read(b)) > 0) {
out.write(b, 0, amount);
* Executes the given ftpd command on the server and writes the results
* returned on the data port to the given FilterOutputStream, returning true
* if the server indicates that the operation was successful.
private boolean setupDataPort(String command, ServerSocket serverSocket)
throws IOException
// Send our local data port to the server
if (!openPort(serverSocket)) return false;
// Set binary type transfer
outputStream.println("type i");
if (!isPositiveCompleteResponse(getServerReply())) {
debugPrint("Could not set transfer type");
return false;
// If we have a restart point, send that information
if (restartPoint != 0) {
outputStream.println("rest " + restartPoint);
restartPoint = 0;
// TODO: Interpret server response here
getServerReply();
// Send the command
outputStream.println(command);
return isPositivePreliminaryResponse(getServerReply());
* Get IP address and port number from serverSocket and send them via the
* <code>port</code> command to the ftp server, returning true if we get a
* valid response from the server, returning true if the server indicates
* that the operation was successful.
private boolean openPort(ServerSocket serverSocket)
throws IOException
int localport = serverSocket.getLocalPort();
// get local ip address
InetAddress inetaddress = serverSocket.getInetAddress();
InetAddress localip;
try {
localip = inetaddress.getLocalHost();
} catch(UnknownHostException e) {
debugPrint("Can't get local host");
return false;
// get ip address in high byte order
byte[] addrbytes = localip.getAddress();
// tell server what port we are listening on
short addrshorts[] = new short[4];
// problem: bytes greater than 127 are printed as negative numbers
for(int i = 0; i <= 3; i++) {
addrshorts[i] = addrbytes;
if (addrshorts[i] < 0)
addrshorts[i] += 256;
outputStream.println("port " + addrshorts[0] + "," + addrshorts[1] +
"," + addrshorts[2] + "," + addrshorts[3] + "," +
((localport & 0xff00) >> 8) + "," +
(localport & 0x00ff));
return isPositiveCompleteResponse(getServerReply());
* True if the given response code is in the 100-199 range.
private boolean isPositivePreliminaryResponse(int response)
return (response >= 100 && response < 200);
* True if the given response code is in the 300-399 range.
private boolean isPositiveIntermediateResponse(int response)
return (response >= 300 && response < 400);
* True if the given response code is in the 200-299 range.
private boolean isPositiveCompleteResponse(int response)
return (response >= 200 && response < 300);
* True if the given response code is in the 400-499 range.
private boolean isTransientNegativeResponse(int response)
return (response >= 400 && response < 500);
* True if the given response code is in the 500-599 range.
private boolean isPermanentNegativeResponse(int response)
return (response >= 500 && response < 600);
* Eliminates the response code at the beginning of the response string.
private String excludeCode(String response)
if (response.length() < 5) return response;
return response.substring(4);
* Prints debugging information to stdout if the private flag
* <code>PRINT_DEBUG_INFO</code> is turned on.
private void debugPrint(String message) {
if (PRINT_DEBUG_INFO) System.err.println(message);
* The socket through which we are connected to the FTP server.
private Socket connectionSocket = null;
* The socket output stream.
private PrintStream outputStream = null;
* The socket input stream.
private BufferedReader inputStream = null;
* The offset at which we resume a file transfer.
private long restartPoint = 0L;
Please help me where am I wrong?
ThanksI would guess the error happens at this line:
} while(!(Character.isDigit(reply.charAt(0)) && ...
because apparently reply.length() is 0 at the point of failure, so charAt(0) is beyond the end of the string. You need to check the length first. -
How to Handle the exception while perform multiple insert in a procedure?
CREATE OR REPLACE PROCEDURE MUL_INS_EXCE AS
CURSOR C IS SELECT EMP_NO,EMP_NAME,EMP_AGE FROM EMP;
EMP_RECORD EMP %ROWTYPE;
BEGIN
OPEN C;
LOOP
FETCH C INTO EMP_RECORD;
EXIT WHEN C%NOTFOUND;
INSERT INTO (SELECT NO,NAME,AGE FROM E1 WHERE AGE >=23 WITH CHECK OPTION VALUE(EMP_RECORD.EMP_NO,EMP_RECORD.EMP_NAME,EMP_RECORD.EMP_AGE);
END LOOP;
CLOSE C;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
I try to insert the record from emp into e1 table with some condition using the procedure. If run this procedure it insert record with check the age > =23. The conditions is not satisfied, exception is thrown procedure will terminate. Again i run this procedure, it will insert the from first. but i want, insert rest of the records. pls help me.>
CHange your insert code like below....it should work
If emp_record.age > 23 Then
Insert into table name (fileld......) values(values)...............
End If;;
>
CREATE OR REPLACE PROCEDURE MUL_INS_EXCE AS
CURSOR C IS SELECT EMP_NO,EMP_NAME,EMP_AGE FROM EMP;
EMP_RECORD EMP %ROWTYPE;
BEGIN
OPEN C;
LOOP
FETCH C INTO EMP_RECORD;
EXIT WHEN C%NOTFOUND;
INSERT INTO (SELECT NO,NAME,AGE FROM E1 WHERE AGE >=23 WITH CHECK OPTION VALUE(EMP_RECORD.EMP_NO,EMP_RECORD.EMP_NAME,EMP_RECORD.EMP_AGE);
END LOOP;
CLOSE C;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
I try to insert the record from emp into e1 table with some condition using the procedure. If run this procedure it insert record with check the age > =23. The conditions is not satisfied, exception is thrown procedure will terminate. Again i run this procedure, it will insert the from first. but i want, insert rest of the records. pls help me. -
Exception while trying to insert data into Target Table
Hi ,
Im trying pick data from a table A which is in DB1 and trying to insert table B which is in DB2 .Below are the steps which I did.But im getting the exception
*"Caused By: java.sql.SQLSyntaxErrorException: ORA-02019: connection description for remote database not found:"* .Can some one help me with this .
Note : The DB that im using is Oracle 10g Express Edition and ODI studio is ODI 11.1.1.5.0
1.Created a two Data Server -one for each Data base (DB1 and DB2)
2.Created two Physical Schema under the respective Data Server
3.Created two Logical Schema referring respective Physical Schema
4.Created a two Models for each Logical schema and did Reverse Engineer
5.Created an Interface , imported the Knowledge models and did the mapping between the Source and Target Data Source
KM's used :
Source data store-Staging Area-LKM Oracle to Oracle (DBLink)
Target Properies-IKM Oracle Incremental Update
I unchecked Stagin Area Different from Target .
Thanks
JohnHi John,
I think you need to create public database link then create public synonym
After creating that, please check it from DB side it is working or not, then check from ODi end and go thru below URL hope this will helps you.
https://forums.oracle.com/forums/thread.jspa?threadID=530074
Thanks,
Phani -
Error while doing bulk collect
Dear forum,
I am getting following error while i try to use the bulk collect
ERROR at line 1:
ORA-06500: PL/SQL: storage error
ORA-04030: out of process memory when trying to allocate 16408 bytes (koh-kghu
call ,pmuccst: adt/record)
ORA-06512: at "XLAPP14.TEST_LOAD", line 30
ORA-06512: at line 2
Pls assist
ThanksThis is a duplicate post.
Please never post more than once.
Everyone should ignore this. -
Cache entries expiring after doing bulk insert
We are seeing this peculiar issue of expired entries when we started using bulk loading in coherence 3.5.
com.tangosol.net.NamedCache.putAll(<hashmap>)
Earlier, we were using com.tangosol.net.NamedCache.put(key,value,EXPIRY_NEVER). This code works without any issues and we never saw any missing entries. Here is our coherence config xml. Any clue?
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>repl-*</cache-name>
<scheme-name>repl-default</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>dist-*</cache-name>
<scheme-name>dist-default</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>GRIDCACHE</cache-name>
<scheme-name>SampleOverflowScheme</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<local-scheme>
<scheme-name>SampleMemoryLimitedScheme</scheme-name>
<high-units>300000</high-units>
<low-units>250000</low-units>
<expiry-delay>24h</expiry-delay>
</local-scheme>
<overflow-scheme>
<scheme-name>SampleOverflowScheme</scheme-name>
<front-scheme>
<local-scheme>
<scheme-ref>SampleMemoryLimitedScheme</scheme-ref>
</local-scheme>
</front-scheme>
<back-scheme>
<external-scheme>
<scheme-ref>SampleDiskScheme</scheme-ref>
</external-scheme>
</back-scheme>
</overflow-scheme>
<external-scheme>
<scheme-name>SampleDiskScheme</scheme-name>
<lh-file-manager>
<directory>/apps/uma/smicache/store2</directory>
<file-name>{cache-name}.store</file-name>
</lh-file-manager>
</external-scheme>
<distributed-scheme>
<scheme-name>dist-default</scheme-name>
<backing-map-scheme>
<class-scheme>
<scheme-ref>default-backing-map</scheme-ref>
</class-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
<class-scheme>
<scheme-name>default-backing-map</scheme-name>
<class-name>com.tangosol.util.SafeHashMap</class-name>
</class-scheme>
<replicated-scheme>
<scheme-name>repl-default</scheme-name>
<backing-map-scheme>
<local-scheme/>
</backing-map-scheme>
<autostart>true</autostart>
</replicated-scheme>
<invocation-scheme>
<service-name>InvocationService</service-name>
<autostart>true</autostart>
</invocation-scheme>
</caching-schemes>
</cache-config>As David already wrote; open the source file in an (hex) editor and check if all line are correctly terminated with carriage return + line feed
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Hi,
I try to understand while I get error above when doing bulk inserts via TimesTen into Oracle database.
The single inserts after that works perfect (no record will dropped), when doing direct to oracle bulk insert works with same data perfect. We tried it with AWT, then with readonly tables and passtrough=2, nothing works. The error comes even the table is empty.
Any suggestions? is this a bug in timesten itself? Have I connect for bulk inserts direct to oracle database?
Thanks in advanced
Rajko AlbrechtIt may be a TT bug but if so it is not an obvious one since bulk inserts definitely work in TimesTen...
Can you please provide:
1. The schema of the table in question (including any indices)
2. Details on how you are doing the bulk inserts (C/ODBC program, Java/JDBC program or ...). Actual program source code would be helpful.
3. A (small) example of the data that you know would give this error.
Thanks,
Chris -
Oracle.jbo.RowNotFoundException exception encountered while doing a ommit
Hi,
I get the following exception while doing :
binding.getDataControl().getApplicationModule().getTransaction().commit();
The application is running in 3-tier with the deployment as BM entity beans.
Any idea why this happens????
Regards,
Anupam
oracle.jbo.RowNotFoundException: JBO-25034: Row of handle 51 is not found in RowSet VReservationMain.
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowFromHandle(RuntimeViewRowSetIteratorInfo.java:535)
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.getRowForSvcMsg(RuntimeViewRowSetIteratorInfo.java:496)
at oracle.jbo.server.remote.RuntimeViewRowSetIteratorInfo.processChanges(RuntimeViewRowSetIteratorInfo.java:367)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.postRows(AbstractRemoteApplicationModuleImpl.java:4220)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgRequest(AbstractRemoteApplicationModuleImpl.java:4267)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgEntries(AbstractRemoteApplicationModuleImpl.java:4995)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.readServiceMessage(AbstractRemoteApplicationModuleImpl.java:4176)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2255)
at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7537)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
at oracle.jbo.server.remote.ejb.NestedApplicationModuleImpl.doMessage(NestedApplicationModuleImpl.java:34)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.dispatchMethod(AbstractRemoteApplicationModuleImpl.java:6279)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.executeMethod(AbstractRemoteApplicationModuleImpl.java:6503)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgRequest(AbstractRemoteApplicationModuleImpl.java:4744)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processSvcMsgEntries(AbstractRemoteApplicationModuleImpl.java:4995)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.readServiceMessage(AbstractRemoteApplicationModuleImpl.java:4176)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.processMessage(AbstractRemoteApplicationModuleImpl.java:2255)
at oracle.jbo.server.ApplicationModuleImpl.doMessage(ApplicationModuleImpl.java:7537)
at oracle.jbo.server.remote.AbstractRemoteApplicationModuleImpl.sync(AbstractRemoteApplicationModuleImpl.java:2221)
at oracle.jbo.server.remote.ejb.ServerApplicationModuleImpl.doMessage(ServerApplicationModuleImpl.java:79)
at oracle.jbo.server.ejb.SessionBeanImpl.doMessage(SessionBeanImpl.java:477)
at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
at com.evermind.server.ejb.StatefulSessionEJBObject.OC4J_invokeMethod(StatefulSessionEJBObject.java:844)
at AMReservationBMBean_RemoteProxy_329700m.doMessage(Unknown Source)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)Hi,
Fault Message Types are used in some of the cases .
This will give good idea-
http://help.sap.com/saphelp_nw2004s/helpdata/en/dd/b7623c6369f454e10000000a114084/frameset.htm
If you want to handle exceptions, you can do for the mapping or even you can do for the unavailability of the receiver i.e database with the help of Alerts for the adapters.
Regards,
Moorthy -
How to handle the bad record while using bulk collect with limit.
Hi
How to handle the Bad record as part of the insertion/updation to avoid the transaction.
Example:
I am inserting into table with LIMIT of 1000 records and i've got error at 588th record.
i want to commit the transaction with 588 inserted record in table and log the error into
error logging table then i've to continue with transaction with 560th record.
Can anyone suggest me in this case.
Regards,
yuva>
How to handle the Bad record as part of the insertion/updation to avoid the transaction.
>
Use the SAVE EXCEPTIONS clause of the FORALL if you are doing bulk inserts.
See SAVE EXCEPTIONS in the PL/SQL Language doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/tuning.htm
And then see Example 12-9 Bulk Operation that continues despite exceptions
>
Example 12-9 Bulk Operation that Continues Despite Exceptions
-- Temporary table for this example:
CREATE TABLE emp_temp AS SELECT * FROM employees;
DECLARE
TYPE empid_tab IS TABLE OF employees.employee_id%TYPE;
emp_sr empid_tab;
-- Exception handler for ORA-24381:
errors NUMBER;
dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(dml_errors, -24381);
BEGIN
SELECT employee_id
BULK COLLECT INTO emp_sr FROM emp_temp
WHERE hire_date < '30-DEC-94';
-- Add '_SR' to job_id of most senior employees:
FORALL i IN emp_sr.FIRST..emp_sr.LAST SAVE EXCEPTIONS
UPDATE emp_temp SET job_id = job_id || '_SR'
WHERE emp_sr(i) = emp_temp.employee_id;
-- If errors occurred during FORALL SAVE EXCEPTIONS,
-- a single exception is raised when the statement completes.
EXCEPTION
-- Figure out what failed and why
WHEN dml_errors THEN
errors := SQL%BULK_EXCEPTIONS.COUNT;
DBMS_OUTPUT.PUT_LINE
('Number of statements that failed: ' || errors);
FOR i IN 1..errors LOOP
DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
DBMS_OUTPUT.PUT_LINE('Error message is ' ||
SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP;
END;
DROP TABLE emp_temp;
Maybe you are looking for
-
How to deactivate open items in F-53
HI, EXperts I am Trying to Post vendor payment thru f-53 . The Screen is displaying all the open items as active. so that I have to deactivate the other open items which are not relevent to my current posting. My requirement is the system should d
-
Set working directory for a single thread
Hi there, Well, there are already some threads about the "working directory" subject. Here's a new variant: I need to have different working directorys for each thread. I am currently enhancing an application to do some similar jobs multithreaded (bu
-
Is there any way to call a method by name?
Hi there, Is there any way to call a method by name? e.g. myobject.whatIAmLookingFor("the_name_of_a_myobject's_method",param1,param2,...); Thanx in advance
-
Is there a USB 3.0 Hub that really works with the Mac Mini?
My Mac Mini's four USB 3.0 ports work fine with my four USB Seagate GoFlex 3.0 hard drives. The drives mount at startup, and perform at expected USB 3.0 speeds. But, when I connect the drives to a USB 3.0 HUB to free up the Mac's USB ports for other
-
Apple Pages 5.0.1
Why are there columns in the header that block text in Apple Pages 5.0.1 and how do I get rid of them?