Solved

Import text file into Oracle table

Posted on 2003-10-27
2
1,988 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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