Can't load remotly
I have written a smaal program that start a class from a webserver but i can't seem to get it right. The problem is that i can't getting the classloader to find the classes i want to load.
this is the program:
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
import java.net.*;
public class Main {
Object o;
public Main(String url, String className) {
try {
URL u[] = new URL[1];
u[0] = new URL(url);
ClassLoader cl = new URLClassLoader(u);
Class c = Class.forName(className, true, cl);
o = c.newInstance();
} catch (Exception ex) {
ex.printStackTrace();
static public void main(String args[]) {
new Main(args[0], args[1]);
}the command line show as follows:
java Main http://localhost/java_classes testapp.TestApplication.start
the program i want to load looks as follows:
package testapp;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class TestApplication {
public TestApplication() {
new MainFrame().setVisible(true);
static public void main(String args[]) {
new TestApplication();
static public void start() {
new TestApplication();
}Any ideas????
it would be great...
the command line show as follows:
java Main http://localhost/java_classes testapp.TestApplication.start
And your classes name is testapp.TestApplication so why did you add ".start" to the end?
Similar Messages
-
How Can I Display Remote Mail Images
I set my iPhone 3G (iOS4) to NOT automatically load remote image as a means of preventing advertising to spammers that I exist. However, there are notes I receive that I would like to view the remote images - i.e. from my bank, broker and other subscribed to newsletters.
However, once I turn "automatically load remote images" to off, there seems to be no way to manually load remote images ad-hoc. Am I wrong or have I missed something in the manual? IF there is a way to manually display remote images, can someone tell me how?
Any help or suggestions would be appreciated.
TIASorry I know this is an old thread but thought I would let you know what I have found as I too have been trying to find this out and stumbled across some other threads.
Looks like this feature is missing and people have been on the case for a few years now! I found some old threads from early 2009, someone even got in contact with apple and the support team didn't know either. So in short even though the manual does indeed say that you can load remote images manually when you have the load remote images setting to off, it looks like we still can't. I am using iOS 4.2.1 and still can't find anywhere where we could load them manually.
So I found in another thread someone said to send in feedback forms to apple using this link:
http://www.apple.com/feedback/iphone.html
I thought this might be a good idea? -
Load remote content in messages (Mail)
Hello All,
Iv'e just upgraded to Yosemite today, and so far, so good, a few teething issues.
The biggest problem I have is with the Mail App.
I just can't get to see remote contant in Mail messages (using my Apple iCould account)
I had no problems in Mavericks, did a straight upgrade. I have tried Preferences -> Viewing -> Load Remote Content in Messages,, but the images in messages just won't show. I am being presented with little boxes and question marls in the place holders of the images.
I have tried to toggle on/off whilst restarting the mail app, but no joy. This is a real deal breaker for me, as mail is probably the main app I use. And having to click the links to open the image in a web browser is a show stopper.
Any help here would be much appreciated, just to add, I had no problems with the Mavericks mail app. This is installed on my Mac Pro (mid 2012) and I'm reluctant to upgrade on my Macbook Air at the moment.Bingo!
Stupid me… This was the reason it didn't work for me. Thanks!
The rule in Little Snitch that broke the images was this one:
/Applications/Mail.app/Contents/MacOS/Mail
Deny any outgoing connection
Process Owner:  Me
On 06/02/2014, Mail tried to establish a connection to static.avast.com on port 80 (http). The request was denied via connection alert.
I guess Mac OS X 10.10 somehow toggled this rule!?
Thanks again, the rule has now been deleted :-)
/Peter -
Can I load xml file from SWC without using @embed
I'm developing a mobile application in which I need to load xml files from File.applicationDirectory. This works great if the xml files are part of the main application swf. But I would like to move these xml files into a SWC so they could be shared across multiple applications.
Using FlashBuilder 4.5, when a SWC is built, I can specify files to embed in the library that are not assets (Assets Tab of Flex Library Build Path). For various design reasons, I do NOT want to embed the xml files via @embed.
When the swc is built and I open it up using a zip utility, I see the xml files in there just fine. So they are being bundled with the SWC. But how can I load these files in my main application that does not involve using @embed? When the main application is built, the swc setting for link type is "merged into code".
I wouldn't expect the application to automatically pull out the xml files from the swc and place them in the File.applicationDirectory on the mobile device. I've tried loading from there just in case but file.exists is false (as expected).
I've searched the web (and continue to do so) and all the answers seem to be to use @embed. Is there another way?
RandyIt's actually a lot easier than you think.
Just reference the file like any'ol URL using a path relative to the SWC's src directory.
So if you include the file "assets/xml/some.xml", just use that same string like you would any remote resource.
For example:
var loader:URLLoader = new URLLoader( new URLRequest("assets/xml/some.xml"));
I believe it would also work like this "/assets/xml/some.xml", but I prefer relative paths so the link doesnt break if moved out of the SWC... -
Can't load any webpages but internet works
I ran into an odd issue on a work computer running OS X Mavericks 10.9.2.
Every morning when I come in, the computer is unable to load any webpages using Chrome or Safari. Other things that rely on an internet connection (but are not accessed through the browser) still work (i.e. LogMeIn Hamachi, Accessing a remote file server, etc).
I don't think it's a DNS issue. I am able to successfully ping any website. AFP requests that rely on DNS lookup also go through. But I am unable to access any website, located on the internal network or the internet even if I know the IP address.
I tried manually setting the DHCP settings and rotating the DNS servers. Still can't load webpages.
I also tried restarting mDNSresponder and it still didn't work. The only thing that works is restarting the computer.
This happens every once in a while on other computers in the office, too.
I'm stumped. Any ideas?
Thanks in advance.Log out under the Apple in the Menu bar.
Log into Guest
Open Safari and see if you see the same behavior
If no, it's an issue in your User's folder.
If yes, it's an base issue.
Even though you are fully updated, running the combo updater can help.
MORE INFO ON WHY RUNNING COMBO FIXES ISSUES
Apple updates available from the Software Update application are incremental updates. Delta updates are also incremental updates and are available from Apple Downloads (software updates are generally smaller than delta updates). The Combo updates contain all incremental updates and will update files that could have become corrupted.
Combo updaters will install on the same version as they're applying--no need to roll back or do a clean install.
"Delta" updaters can only take you from one version to the next. For example: 10.9.3 to 10.9.4. If somehow the 10.9.3 is missing something it should have, and that something isn't changed between 10.9.3 and 10.9.4 it will still be stale after the delta update. -
IOS 5: Manually load REMOTE images in HTML emails ...?
I've been clamoring for this feature forever, and Apple finally added it in 3.0.... the ability to NOT download remotely hosted HTML images in emails [mainly to prevent additional spam]..... unfortunately, if you turn off the loading of remote images in your settings, you're unable to load them in manually on a per-email basis.
SO CLOSE!
Does anyone know if this is possible now on iOS 5? Would love it to work like their desktop mail appvarjak paw wrote:
Settings -> Mail, Contacts, Calendars -> Load Remote Images -> Off
Regards.
Yes that's how you turn it off. Now that you have it off, and an image arrives whose images you want to view, you can't do it. You can turn the setting back on, but then all the other emails whose images you don't want to open, will open, leaving you vulnerable. There should be a button in the mail viewer to load images when viewing an e-mail if this setting is off, just like Mail in OSX. I think it's an oversight. -
Loading remote sharedObject data from FMS 3.5 in AS3
Porting from AS2 to AS3 and have a problem in the terminology, methods and syntax for loading remote sharedObject data. Here's what I have working in AS2 (This works in AS2 but not in AS3)::
if (info.code == "NetConnection.Connect.Success") {
drawing_so = SharedObject.getRemote("mySharedObj", main_nc.uri, true);
drawing_so.onSync = function(list) {
for (var n in list) {
var line_obj = this.data[list[n].name];
trace ("This name = " + line_obj);
So I got the synching working ( I know that's different) and running error-free but it won't parse the data, nor can I get it into an array as above. Here's what I tried::
if (cn.info.code.indexOf("Success") != -1) {
trace("I'M CONNECTED ");// < --- this works
drawing_so = SharedObject.getRemote("mySharedObj", nc.uri, true);
drawing_so.addEventListener(SyncEvent.SYNC, syncSO);
drawing_so.connect(nc);
and the EventListener function is ::
function syncSO(event:SyncEvent):void {
var myList:Array = drawing_so.data.list;
for (var n in myList) {
trace("N = " + n);
var line_obj = this.data[myList[n].name]; // < - - - not able to retrieve values from the sharedObject
trace ("This name = " + line_obj);
So I'm just not familiar with the terminology here.
Sorry - I went through all your excellent tutorials to try to find this and scoured the forum as well. Maybe this would be a good, simple AS3 to FMS 3.5 tutorial! B^)
Thanks for you help,
BobkatzzHI
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0c63b84-19e5-2910-fc81-f438716573d5
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/506eb432-0575-2b10-d986-8b41daa4d7af -
In mail. What does it mean to to turn off on 'Load remote images?'
In mail. What does it mean to turn off or on 'Load Remote Images?'
From Mail's help:
Show or hide remote images
Some messages may use HTML to include remote images that, when retrieved from the sender’s servers, reveal information about your Mac. You can protect your privacy by not loading remote images contained in messages you receive. In addition, when you don’t load remote images, messages display more quickly.
Choose Mail > Preferences, and then click Viewing.
Select or deselect the “Display remote images in HTML messages” checkbox to show or hide the images.
If you chose to hide remote images, a banner is displayed across the top of messages that contain remote images, asking whether you want to load them for viewing.
If Mail detects that a message is junk mail, HTML images aren’t displayed. -
Load remote images in iPad Mail?
In Mail Settings I have load remote images off. On my computer I can click a button in Apple Mail to load remote images. Is there any way I can tell the Mail ap on my iPad to load remote images on a single message without having to make the global change in Settings?
You're welcome. I played around with the mail app for a while and still couldn't find a way to do it so I'm pretty convinced now that it isn't possible.
-
Can't connect remotely after updating to Snow Leopard
Hi,
I've been connecting remotely (using SFTP) to my office computer with Fetch fine, My co-worker just updated the system software from OS 10.5 to OS 10.6, and now I cannot connect to the computer...any suggestions of what I should do? The only thing that changed that I can see is that with 10.5 I had to connect using port 222, and now I'm told I need to use port 22. Still can't connect though.
Thanks for any input!So you've got a Mac running 10.5 at home, and you're trying to connect to a Mac running 10.6 at work, and you can no longer connect to that 10.6 computer but your coworker can connect to that same computer? What kind of computer is the coworker using from home? If a Mac, what OS is she running at home? How is she connecting? (Terminal.app command line? GUI front-end interface program like Fetch? Or Fetch itself?) If she is using a GUI program, I think that some of them display to the user a command-line style of text that it is using to connect to the distant end (I know that ssh tunnel used to). It would be helpful to know precisely what command is being sent from her and from you. If you could post those (masking, obviously, the username and hostname or host IP address as "user@host"), that would, I think, be an immense help.
I do a lot of ssh and sftp to my home network from work and other itinerant locations using Terminal.app program. I type "ssh user@host" or "sftp user@host". That's why I'm asking if your coworker's sftp program actually displays the command sent. Both of these commands (ssh and sftp) can be loaded up with various optional switches to facilitate different or additional behaviors. For example, actually, I use
"ssh -p22222 -L10025:localhost:25 -L10143:localhost:143 –L10548:localhost:548
–L15900:localhost:5900 user@host" so that I can tunnel a bunch of other services (AFP file transfer, remote screen sharing, and receive and send email through my own personal five-account IMAP mail server) all encrypted inside the ssh connection. Or "sftp –oPort=22222 user@host" for encrypted file transfer from the command line. It would be helpful to know what her sftp program is actually sending to the work computer.
Any possibility of a username or password change on the work computer? You made mention about a port switch from 222 to 22...did you make that corresponding change on your sftp program at home as well? Who told you that you had to make that change and why? Lastly, while I can't give any good reason at all as to why it would make any difference, but I see that Fetch is now at version 5.5.3 as of 16 Nov 2010. Are you using the latest and greatest? -
Can't load class problems migrating from PE 8.1 to PE 8.2
Hi. I'm in the process of migrating an application from an old server that runs PE 8.1_02 to a new server that runs PE 8.2.
The application is coded and built in Creator 2.0; the resulting .war file deploys alright into both servers, and operates correctly on the 8.1 server, but throws various "Can't load class" errors on my 8.2 server. One of them looks like this:
exception
javax.servlet.ServletException: Missing Class: Can't load class 'com.talentmap.talentexitadmintool.fields.TextBoxField'.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
java.security.AccessController.doPrivileged(Native Method)
com.talentmap.talentexitadmintool.utils.security.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:91)
root cause
javax.faces.FacesException: Missing Class: Can't load class 'com.talentmap.talentexitadmintool.fields.TextBoxField'.
com.sun.faces.util.TreeStructure.createComponent(TreeStructure.java:130)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:464)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreComponentTreeStructure(StateManagerImpl.java:466)
com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:314)
com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:230)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:337)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:157)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:225)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:193)
sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
java.security.AccessController.doPrivileged(Native Method)
com.talentmap.talentexitadmintool.utils.security.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:91)
The class that is "missing" (TextBoxField) is very definitely there in the usual place under WEB-INF/classes. I can't figure out why it can't be loaded. The weird part is that a lot of the code still works, but these errrors have broken many of the major functions of our software.
On a hunch I realized that perhaps Creator 2.0 was using some 8.1 specific libraries to build, so I replaced the following libraries with versions found in my appserv tree:
activation.jar
appserv-jstl.jar
appserv-tags.jar
commons-logging.jar
j2ee.jar
jax-qname.jar
jaxr-api.jar
jaxr-impl.jar
jaxrpc-api.jar
jaxrpc-impl.jar
jsf-api.jar
jsf-impl.jar
mail.jar
saaj-api.jar
saaj-impl.jar
Rebuilding with those copied libraries made no difference.
Anyone know what could be causing this? Is there a workaround or fix? Do I need to update Creator with something? Should I revert to 8.1? Should I try moving to 9.0?I solve this problem by doing a remote deployment via creator2 remote deployment server.. first you must take care of JNDI stuff..
I hope this help.. give me feedback -
Load remote content in mail only for approved addresses
Is there a way to configure mail to automatically load content of only approved addresses? I don't want to always load remote content but, there are some addresses that I would like to load the remote content automatically. I only seem to be able to load it for everyone or no one.
Thanks a lot
PWell, maybe someone else can get this working better, but I have a rule set that will Load Remote Content when you click on Apply Rules and are seeing the email in the Preview window. Of course that kind of defeats the purpose a bit, but I used the program Mouse Position Menu to click on an area of the screen where the button is located. Here is the script info.
set x to 1830
set y to 118
set l to 1
do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
for x in range(0, " & l & "):
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END"
My screen is a 21.5" running at the native 1920x1080 resolution. So my coordinates were 1830,118 and I plugged them in to the AppleScript above.
Here is the link to the original click thread with the credit of who came up with the above scripting info.
http://discussions.apple.com/thread/3708948 -
Can I load VLAN's via tftp to startup?
Can I load the 3 VLAN's I want to create on a router just by adding them to the tftp config I upload to startup? I keep getting an error.
Here is whats at the top of my tftp config file:
! ===============================================
! Company DHCP Remote Site Config Script
! Pay attention to Spaces and Non Spaces!!
! DHCP SITES MUST USE 12.4(4)4T CODE!!!!!
! ===============================================
vlan database
vlan 1
vlan 2
vlan 3
apply
exit
conf t
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
hostname 1234
boot-start-marker
boot-end-marker
no parser cache
no service config
~snip~12.4(9)T means you have a router with an etherswitch network module. What kind of NM is it? If you have an NME-16ES or any NME, this is a switch module equivalent to an external 3750 and it has it's own IOS, configuration and NVRAM - it's a switch in a module.
Here are more info on that NME, in case it's what you have:
http://www.cisco.com/en/US/products/hw/modules/ps2797/products_feature_guide09186a0080415bae.html
Please rate helpful posts. -
Javax.faces.FacesException: Missing Class: Can't load class
Hi,
I want to implement in process wizard using JSF. I have created a button panel which have "Back", "Next","Finish","Cancel" and "Help" button and also have create a process indicator which indicate the current page by highlighting.
Both Buttonbar class and ProcessBar are interacting with a Model.
I have declared a static variable to indicate the current page no, default value is zero. This static variable is getting updated by "Back" (-1) and "Next"(+1) button action.
For the first time wizardPage is loaded fine but in pressijng of "Next" button, it throws me
javax.faces.FacesException: Missing Class: Can't load class
'com.cassiopae.framework.demo.faces.uicomponent.WizardProcessTrain'
But WizardProcessTrain class and WizardButtonBar class are loading properly when screen is loading.
Any one know the reason, please help me out.
Thanks in advance.I solve this problem by doing a remote deployment via creator2 remote deployment server.. first you must take care of JNDI stuff..
I hope this help.. give me feedback -
How can I load my data faster? Is there a SQL solution instead of PL/SQL?
11.2.0.2
Solaris 10 sparc
I need to backfill invoices from a customer. The raw data has 3.1 million records. I have used pl/sql to load these invoices into our system (dev), however, our issue is the amount of time it's taking to run the load - effectively running at approx 4 hours. (Raw data has been loaded into a staging table)
My research keeps coming back to one concept: sql is faster than pl/sql. Where I'm stuck is the need to programmatically load the data. The invoice table has a sequence on it (primary key = invoice_id)...the invoice_header and invoice_address tables use the invoice_id as a foreign key. So my script takes advantage of knowing the primary key and uses that on the subsequent inserts to the subordinate invoice_header and invoice_address tables, respectively.
My script is below. What I'm asking is if there are other ideas on the quickest way to load this data...what am I not considering? I have to load the data in dev, qa, then production so the sequences and such change between the environments. I've dummied down the code to protect the customer; syntax and correctness of the code posted here (on the forum) is moot...it's only posted to give the framework for what I currently have.
Any advice would be greatly appreciated; how can I load the data faster knowing that I need to know sequence values for inserts into other tables?
DECLARE
v_inv_id invoice.invoice_id%TYPE;
v_inv_addr_id invoice_address.invoice_address_id%TYPE;
errString invoice_errors.sqlerrmsg%TYPE;
v_guid VARCHAR2 (128);
v_str VARCHAR2 (256);
v_err_loc NUMBER;
v_count NUMBER := 0;
l_start_time NUMBER;
TYPE rec IS RECORD
BILLING_TYPE VARCHAR2 (256),
CURRENCY VARCHAR2 (256),
BILLING_DOCUMENT VARCHAR2 (256),
DROP_SHIP_IND VARCHAR2 (256),
TO_PO_NUMBER VARCHAR2 (256),
TO_PURCHASE_ORDER VARCHAR2 (256),
DUE_DATE DATE,
BILL_DATE DATE,
TAX_AMT VARCHAR2 (256),
PAYER_CUSTOMER VARCHAR2 (256),
TO_ACCT_NO VARCHAR2 (256),
BILL_TO_ACCT_NO VARCHAR2 (256),
NET_AMOUNT VARCHAR2 (256),
NET_AMOUNT_CURRENCY VARCHAR2 (256),
ORDER_DT DATE,
TO_CUSTOMER VARCHAR2 (256),
TO_NAME VARCHAR2 (256),
FRANCHISES VARCHAR2 (4000),
UPDT_DT DATE
TYPE tab IS TABLE OF rec
INDEX BY BINARY_INTEGER;
pltab tab;
CURSOR c
IS
SELECT billing_type,
currency,
billing_document,
drop_ship_ind,
to_po_number,
to_purchase_order,
due_date,
bill_date,
tax_amt,
payer_customer,
to_acct_no,
bill_to_acct_no,
net_amount,
net_amount_currency,
order_dt,
to_customer,
to_name,
franchises,
updt_dt
FROM BACKFILL_INVOICES;
BEGIN
l_start_time := DBMS_UTILITY.get_time;
OPEN c;
LOOP
FETCH c
BULK COLLECT INTO pltab
LIMIT 1000;
v_err_loc := 1;
FOR i IN 1 .. pltab.COUNT
LOOP
BEGIN
v_inv_id := SEQ_INVOICE_ID.NEXTVAL;
v_guid := 'import' || TO_CHAR (CURRENT_TIMESTAMP, 'hhmissff');
v_str := str_parser (pltab (i).FRANCHISES); --function to string parse - this could be done in advance, yes.
v_err_loc := 2;
v_count := v_count + 1;
INSERT INTO invoice nologging
VALUES (v_inv_id,
pltab (i).BILL_DATE,
v_guid,
'111111',
'NONE',
TO_TIMESTAMP (pltab (i).BILL_DATE),
TO_TIMESTAMP (pltab (i).UPDT_DT),
'READ',
'PAPER',
pltab (i).payer_customer,
v_str,
'111111');
v_err_loc := 3;
INSERT INTO invoice_header nologging
VALUES (v_inv_id,
TRIM (LEADING 0 FROM pltab (i).billing_document), --invoice_num
NULL,
pltab (i).BILL_DATE, --invoice_date
pltab (i).TO_PO_NUMBER,
NULL,
pltab (i).net_amount,
NULL,
pltab (i).tax_amt,
NULL,
NULL,
pltab (i).due_date,
NULL,
NULL,
NULL,
NULL,
NULL,
TO_TIMESTAMP (SYSDATE),
TO_TIMESTAMP (SYSDATE),
PLTAB (I).NET_AMOUNT_CURRENCY,
(SELECT i.bc_value
FROM invsvc_owner.billing_codes i
WHERE i.bc_name = PLTAB (I).BILLING_TYPE),
PLTAB (I).BILL_DATE);
v_err_loc := 4;
INSERT INTO invoice_address nologging
VALUES (invsvc_owner.SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
v_inv_id,
'BLAH INITIAL',
pltab (i).BILL_DATE,
NULL,
pltab (i).to_acct_no,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
SYSTIMESTAMP,
NULL);
v_err_loc := 5;
INSERT INTO invoice_address nologging
VALUES ( SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
v_inv_id,
'BLAH',
pltab (i).BILL_DATE,
NULL,
pltab (i).TO_ACCT_NO,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
SYSTIMESTAMP,
NULL);
v_err_loc := 6;
INSERT INTO invoice_address nologging
VALUES ( SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
v_inv_id,
'BLAH2',
pltab (i).BILL_DATE,
NULL,
pltab (i).TO_CUSTOMER,
pltab (i).to_name,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
SYSTIMESTAMP,
NULL);
v_err_loc := 7;
INSERT INTO invoice_address nologging
VALUES ( SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
v_inv_id,
'BLAH3',
pltab (i).BILL_DATE,
NULL,
'SOME PROPRIETARY DATA',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
SYSTIMESTAMP,
NULL);
v_err_loc := 8;
INSERT
INTO invoice_event nologging (id,
eid,
root_eid,
invoice_number,
event_type,
event_email_address,
event_ts)
VALUES ( SEQ_INVOICE_EVENT_ID.NEXTVAL,
'111111',
'222222',
TRIM (LEADING 0 FROM pltab (i).billing_document),
'READ',
'some_user@some_company.com',
SYSTIMESTAMP);
v_err_loc := 9;
INSERT INTO backfill_invoice_mapping
VALUES (v_inv_id,
v_guid,
pltab (i).billing_document,
pltab (i).payer_customer,
pltab (i).net_amount);
IF v_count = 10000
THEN
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
errString := SQLERRM;
INSERT INTO backfill_invoice_errors
VALUES (
pltab (i).billing_document,
pltab (i).payer_customer,
errString || ' ' || v_err_loc
COMMIT;
END;
END LOOP;
v_err_loc := 10;
INSERT INTO backfill_invoice_timing
VALUES (
ROUND ( (DBMS_UTILITY.get_time - l_start_time) / 100,
2)
|| ' seconds.',
(SELECT COUNT (1)
FROM backfill_invoice_mapping),
(SELECT COUNT (1)
FROM backfill_invoice_errors),
SYSDATE
COMMIT;
EXIT WHEN c%NOTFOUND;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
errString := SQLERRM;
INSERT INTO backfill_invoice_errors
VALUES (NULL, NULL, errString || ' ' || v_err_loc);
COMMIT;
END;Hello
You could use insert all in your case and make use of sequence.NEXTVAL and sequence.CURRVAL like so (excuse any typos - I can't test without table definitions). I've done the first 2 tables, so it's just a matter of adding the rest in...
INSERT ALL
INTO invoice nologging
VALUES ( SEQ_INVOICE_ID.NEXTVAL,
BILL_DATE,
my_guid,
'111111',
'NONE',
CAST(BILL_DATE AS TIMESTAMP),
CAST(UPDT_DT AS TIMESTAMP),
'READ',
'PAPER',
payer_customer,
parsed_francises,
'111111'
INTO invoice_header
VALUES ( SEQ_INVOICE_ID.CURRVAL,
TRIM (LEADING 0 FROM billing_document), --invoice_num
NULL,
BILL_DATE, --invoice_date
TO_PO_NUMBER,
NULL,
net_amount,
NULL,
tax_amt,
NULL,
NULL,
due_date,
NULL,
NULL,
NULL,
NULL,
NULL,
SYSTIMESTAMP,
SYSTIMESTAMP,
NET_AMOUNT_CURRENCY,
bc_value,
BILL_DATE)
SELECT
src.billing_type,
src.currency,
src.billing_document,
src.drop_ship_ind,
src.to_po_number,
src.to_purchase_order,
src.due_date,
src.bill_date,
src.tax_amt,
src.payer_customer,
src.to_acct_no,
src.bill_to_acct_no,
src.net_amount,
src.net_amount_currency,
src.order_dt,
src.to_customer,
src.to_name,
src.franchises,
src.updt_dt,
str_parser (src.FRANCHISES) parsed_franchises,
'import' || TO_CHAR (CURRENT_TIMESTAMP, 'hhmissff') my_guid,
i.bc_value
FROM BACKFILL_INVOICES src,
invsvc_owner.billing_codes i
WHERE i.bc_name = src.BILLING_TYPE;Some things to note
1. Don't commit in a loop - you only add to the run time and load on the box ultimately reducing scalability and removing transactional integrity. Commit once at the end of the job.
2. Make sure you specify the list of columns you are inserting into as well as the values or columns you are selecting. This is good practice as it protects your code from compilation issues in the event of new columns being added to tables. Also it makes it very clear what you are inserting where.
3. If you use WHEN OTHERS THEN... to log something, make sure you either rollback or raise the exception. What you have done in your code is say - I don't care what the problem is, just commit whatever has been done. This is not good practice.
HTH
David
Edited by: Bravid on Oct 13, 2011 4:35 PM
Maybe you are looking for
-
IPOD NANO FAILED DURING UPDATE AND NOW NOT RESPONDING
HI, I have an ipod 4gb nano. I had songs loaded on it and it was working fine. I downloaded the latest version of the ipod updater (2006-03-23) to update my ipod. During the update process the battery on my laptop died and now I cant do anything. If
-
Bought a new Canon MG7540 printer to replace the old HP A618. When printing vector objects from Illustrator, they look like graphics from dandy (8 bits) ... no smooth, all cubes ... if do raster than print perfectly. Who knows how to treat it? No we
-
Is it possible to format the y axis on a chart to show currency amounts instead of just numbers? Thanks.
-
What is the easiet way to mix 8bit 8000Hz PCM_ULAW samples?
Hi! I want to mix to multiple ULAW samples together. Is there a way to do so without converting to PCM? Im trying to do a 8000Hz 8bit VoIP app. Im testing with AU files (created in goldwave) since they use the ULAW encoding. My current implementation
-
Making media:/ in KDE 3.5 play nicely
media:/ as of now lists only my CD/DVD and flopp drive. I have an external storage drive and need it to list that too so that I don't have to mount it manually. Actually, in KDE 3.4, all my hard disks were in media:/ and I prefer it that way. Now its