[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Import text file into Oracle table

Posted on 2003-10-27
2
Medium Priority
?
1,997 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 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 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