Solved

Import text file into Oracle table

Posted on 2003-10-27
2
1,991 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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