Solved

Import text file into Oracle table

Posted on 2003-10-27
2
1,986 Views
Last Modified: 2008-03-10
I need to build a web page that allows the user to import a text file into an Oracle table.  Does anyone have a code example of doing this?  The text file is not delimited in any way.  I know that you have to use the FilsSystemObject to read the text file.  I need to read the text file line by line and store the data in the Oracle table.  DOes anyone have a code example?

Thanks.
0
Comment
Question by:mnord
2 Comments
 
LVL 7

Accepted Solution

by:
RBertora earned 250 total points
ID: 9627670
it goes something like this......

identify your tnsnames by finding your tnsnames.ora file

tnsnames.ora_alias =(DESCRIPTION = (ADDRESS = (PROTOCOL=TCP)(Host=247.249.22.231)(Port=1500))
      (CONNECT_DATA = (SID = yourSID)))

then here is the code you would need in asp:


      Set objConn = Server.CreateObject("ADODB.Connection")
      objConn.ConnectionString = "DSN=tnsnames.ora_alias;UID=username;PWD=password"
      objConn.Open

      Dim fs, a
      Set fs = CreateObject("Scripting.FileSystemObject")
      Set a = fs.OpenTextFile("C:\File.txt")

      if err.number = 0 then
          while not (a.atEndOfStream)

            text_str = a.ReadLine
            SqlString = "Insert into Table (Column) values '" + text_str.Replace("'","''") + "'"
            objConn.SqlString SqlString

          wend

      else
            Response.write(err.description)
      end if

later,
Rob;-)
0
 
LVL 8

Expert Comment

by:fozylet
ID: 9628103
For the uploading part, see...

http://www.freeaspupload.net/
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now