Sponsored Content
Top Forums Shell Programming and Scripting How to insert data into MYSql database from a text file Post 302156381 by shirleyeow on Tuesday 8th of January 2008 03:33:24 AM
Old 01-08-2008
All the data become NULL after load into database

Hi sysgate,

Sorry that I just have time tested on this.

After I load the data from text file, all the value become NULL in the database. I created the datatype to be VARCHAR(32) and also INT(20) but all show me the same NULL result. For the date, I declared the datatype as DATE, it also show the NULL value.

I really dont know what is happening. When I execute this command, it didnt show any error. Really dont know how to debug on this. Smilie Please advise. Thank you so much.

Br,
Shirley
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to insert data in database based on text file?

Hi....can you guys help me out in this script?? Below is a text file script....called Bukom.txt and it contains these: BUKOM 20060101 2.5 2.6 2.7 2.8 2.9 2.3 2.1 BUKOM 20060102 2.4 2.5 2.6 2.7 2.7 2.6 2.4 BUKOM 20060103 2.1 ... (9 Replies)
Discussion started by: forevercalz
9 Replies

2. Shell Programming and Scripting

Need Shell Script to upload data from Text file to Oracle database

Hi Does any one have any idea on uploading the data using Unix Shell script from text file to Oracle database. Requirement:- 1. Need to connect to Oracle database from Unix Shell script. 2. Need to pick Text file from some location on Unix Box. 3. Need to upload the data from text file to... (6 Replies)
Discussion started by: chandrashekharj
6 Replies

3. Shell Programming and Scripting

how to insert data into database by reading it from a text file??

Hi....can you guys help me out in this script?? Below is a text file and it contains these: GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL005675 000001... (4 Replies)
Discussion started by: pallavishetty
4 Replies

4. Shell Programming and Scripting

shell script to insert data from gps.txt to mysql database

Hi, I have gps receiver, by using gpsd data i can read gps log data to my database(my sql). Steps: 1. telenet localhost 2947 > gps.txt (press enter) 2. r (press enter) //then i will get the data like below in gps.txt file Trying 127.0.0.1... Connected to localhost.... (1 Reply)
Discussion started by: gudivada213
1 Replies

5. Web Development

INSERT data to a Database Table from a text file

If you have a text file and if you want to Insert data to your Database Table, You can do it with these queries LOAD DATA LOCAL INFILE '/path/yourTextFile.txt' INTO TABLE yourTableName FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n' (0 Replies)
Discussion started by: sitex
0 Replies

6. Shell Programming and Scripting

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

7. Shell Programming and Scripting

Scrape 10 million pages and save the raw html data in mysql database

I have a list of 10 million page urls. I want those pages scraped and saved in the mysql database as raw html. I own a Linux VPS server with 1GB RAM and WHM/cPanel. I would like to scrape at least 100,000 urls in 24 hours. So can anyone give me some sample shell scripting code? (4 Replies)
Discussion started by: Viruthagiri
4 Replies

8. Shell Programming and Scripting

Need help on Insert data to phpMyAdmin mySQL database from Shell Script

Sorry to disturb you, I would like to seek help on inserting data whenever the switch is on or off to my phpMyAdmin mySQL database from my Shell Script. I'm using Raspberry PI as my hardware and I have follow this LINK: instructables.com/id/Web-Control-of-Raspberry-Pi-GPIO/?ALLSTEPS to create my... (4 Replies)
Discussion started by: aoiregion
4 Replies

9. Programming

Need help on Insert data to mySQL database

Hi guys, I would like to seek help on inserting data whenever the switch is on or off to my sensor mySQL database in phpMyAdmin from my control.php. I'm using Raspberry PI as my hardware and follow a few tutorials to create my own Web Control Interface, it works perfectly without insert method.... (1 Reply)
Discussion started by: aoiregion
1 Replies

10. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies
PG_ESCAPE_LITERAL(3)													      PG_ESCAPE_LITERAL(3)

pg_escape_literal - Escape a literal for insertion into a text field

SYNOPSIS
string pg_escape_literal ([resource $connection], string $data) DESCRIPTION
pg_escape_literal(3) escapes a literal for querying the PostgreSQL database. It returns an escaped literal in the PostgreSQL format. pg_escape_literal(3) adds quotes before and after data. Users should not add quotes. Use of this function is recommended instead of pg_escape_string(3). If the type of the column is bytea, pg_escape_bytea(3) must be used instead. For escaping identifiers (e.g. table, field names), pg_escape_identifier(3) must be used. Note This function has internal escape code and can also be used with PostgreSQL 8.4 or less. PARAMETERS
o $connection - PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection is the last connection made by pg_connect(3) or pg_pconnect(3). o $data - A string containing text to be escaped. RETURN VALUES
A string containing the escaped data. EXAMPLES
Example #1 pg_escape_literal(3) example <?php // Connect to the database $dbconn = pg_connect('dbname=foo'); // Read in a text file (containing apostrophes and backslashes) $data = file_get_contents('letter.txt'); // Escape the text data $escaped = pg_escape_literal($data); // Insert it into the database. Note that no quotes around {$escaped} pg_query("INSERT INTO correspondence (name, data) VALUES ('My letter', {$escaped})"); ?> SEE ALSO
pg_escape_identifier(3), pg_escape_bytea(3), pg_escape_string(3). PHP Documentation Group PG_ESCAPE_LITERAL(3)
All times are GMT -4. The time now is 02:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy