wood burning stoves 2.0*
The moose likes JDBC and the fly likes OpenCSV Error on server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "OpenCSV Error on server" Watch "OpenCSV Error on server" New topic
Author

OpenCSV Error on server

Eduardo Ponce de Leon
Ranch Hand

Joined: May 13, 2009
Posts: 99
I have my projec where I upload a file and it insets it into a DB. When I run my project in eclipse everything works like a charm, howeve when I export my project to a .war file and deploy in my Tomcat Server and try to upload the same file. I get the following error.



I noticed that for some reason a .jar from is not getting exported, so I added it manually to my .war file but this still does not solve my problem, what am I missing or doing wrong. Or is it just simply that since my file is on my local computer then the server cannot find it? If so, how do I pass a path to the server from my local computer to use that file and insert it to a DB. This is my current method that works if I run my app in eclipse.

Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
You should not be giving the local file path as a request parameter. if you requirement is to upload a file and then insert that into db then you will require 3rd party jars like commons-fileupload
to upload the file to servlet and then you can save the uploaded file to db.
Eduardo Ponce de Leon
Ranch Hand

Joined: May 13, 2009
Posts: 99
ok! Maybe I didnt explain myself, I am not trying to save the file to the dabase. I am trying to open the file with OpenCSV read the file, take the colums that I need and Insert them into my database. But I am unsure on how to do all this from the server.
Piyush Mangal
Ranch Hand

Joined: Jan 22, 2007
Posts: 196
Ok, don't save the file into database if not required. But still you will need to upload the file through 3rd party lib like commons-fileupload and you will receive a byte[] array at server side. Now you can do whatever you want to do with byte[]. You can create a File object and extract the desired columns out of it.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

You don't even need to create a file; use a ByteArrayInputStream wrapped in an InputStreamReader to provide to the CSVReader.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: OpenCSV Error on server
 
Similar Threads
This connection has been closed ERROR!!
problem with the request dispatcher
Error 500 in root causes saying not enough value error
HTTP status 500
SQL Server JDBC Connectivity Error