• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

How to Upload a file to oracle database using JSP or Servlets

 
Ranch Hand
Posts: 47
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I want to uplaod a file(csv or excel) to Oracle 10g database, using Jsp or Servlets....


Addfile.jsp


UploadFile.jsp


This is my code...Its not uploading the file, it is giving me Error--> Index 1, size 1. Please help me ..how to do this. I am trying to upload a csv file to oracle db from jsp page, csv file has two fields PartNo and SerialNo. The Oracle table InventoryDB_main has 23 columns including PartNo, SerialNo. Please can anyone help me how to upload a file to oracle database.

Thanks in advance
Lissy.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Step 1: get the code out of a JSP and into a servlet. Then we can discuss step 2.
 
Marshal
Posts: 28296
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't know what line of code threw that exception, do you? In your catch block you should print the whole stack trace, like this:


Only since the code is in a JSP, the line numbers in the stack trace which you get won't match the line numbers in the JSP, because the JSP is compiled into something else where the line numbers are different. So as Bear said... put the code into a servlet.
 
lisy jessica
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. Will try this.
 
Greenhorn
Posts: 20
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

lisy jessica wrote:Thanks for the reply. Will try this.




http://www.roseindia.net/jsp/file_upload/uploadingMultipleFiles.shtml

Try this link if you want full explanation along with the code.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not use the code of that link. It irresponsibly puts code in a JSP just like we have been advising not to. The roseindia site should be avoided as its examples rarely exhibit proper practices and good coding.
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic