Great ideas. I figure I will end up going with the inline example that was shown in another response. I know one of the guys that worked on the Poi project, I'll try and hook you guys up if you're interested.
> -----Original Message----- > From: Denny Valliant [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 15, 2006 4:17 AM > To: CF-Talk > Subject: Re: Java/CF Question > > Yo Loathe, nice addy. :-) > > If you're wanting to get into Java with CF, and wanting to use java > classes you roll yourself, I'd say have a look at JDT and class loaders. > > That way you can compile your .java file right from a .cfm, editing both > at the same time. I like that better than compiling the .java, adding > it to CF's classpath, etc.. > > Or you can code in .jsp and skip the .java compilation. > > FWIW, there are no special classes you need to include in your > java code to interact with CF. Just be sure any jars that aren't > included with CF are added to the classpath, and code away. > > For your specific example, I'd try to use a "native" data import > tool and then do the validation via SQL, as I think that would be > orders of magnitude faster, but it's a good way to get into the mix. > Assuming it's, or could be, a lot of data. > > If you need help turning files into say, ByteArrayInputStreams, to > pass them back and forth, just holler, but it will be faster in this > case to pass a string with the file path probably. Skip at least > that chunk of processing. > > Eventually I'll get an example of using JExcelAPI to import/export > true excel documents posted somewhere, which would be a > decent example of passing streams and such... > > :Denny > > On 8/14/06, loathe <[EMAIL PROTECTED]> wrote: > > > > I have a need to parse in a data file weekly. > > > > The file is about 2200 lines long and is in a fixed width format. > > > > It will be written to a DB2 database on a mainframe. > > > > I'm thinking that I should create a java object that will do the heavy > > lifting, only using CF as needed for the interface side of things, and > to > > return some bad data information (there is some validation against > > existing > > data that needs to occur as the file is parsed into memory. > > > > 1. Ok, I know about createObject(), and how it works, is there anything > I > > need in a class file in order for it to talk properly to CF? Anything I > > would want to have? I know I'm using the FileInputStream class, and > > getRow() and blah blah, is this the correct way of doing this? > > > > 2. How do I pass a file from CF to Java? I was thinking the easiest > way > > would be just have CF upload it, pass the path and file info to the > object > > > > and then have the class parse it, write it to the db, and return an > array > > of > > the bad rows. > > > > 3. What are the best practices for an object like this? Should I > create > > one method that reads in the file, one to get the row, a method to get > and > > > > set each member of the row? Or should I just do it top to bottom > > procedural > > style, read in the file, loop through the rows, stick each "column" in > an > > array, then grab them as needed, and so forth? > > > > Any pointers from people that have done this before, or to some online > > info > > about a similar practice would be much appreciated. > > -- > > Thanks, > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249841 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

