Hai all.....
I have a tcp dump file a darpa intrusion detection data set....I opened it thru a tool called Wireshark and i could see the columns as No,Time,Source ip,Destination ip,Protocol,Info......
Using this tool i converted the .tcpdump file int Comma seperated value(CSV) file...
My goal is to add the data set into sql server database....
when i wrote the c# code to add a csv file into database it showing an error called the file is not present in the directory....but actually the csv file is there but in unrecognized format...How do i rectify it...
Help me please.....
Adding csv file to database
6 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Bechir BejaouiRank #144 · 15.9K pointsPosted Dec 16, 2008, 1:41 PM EST
Former memberPosted Dec 16, 2008, 6:28 PM EST
I dont know much about blob data type....and which one is easier n preferable to do....anyway i go for the last...adding the stock to each individual data column.....
Bechir BejaouiRank #144 · 15.9K pointsPosted Dec 17, 2008, 12:17 PM EST
About stocking/retrieving a Blob file to/from a data base I suggest this Amr's article
Former memberPosted Jan 22, 2009, 5:42 PM EST
Thanks for the reply......anyway how can i post a file in this forum to show the csv file which i am working in.......
Thanks...
Md Babu2 pointsPosted Apr 13, 2009, 11:44 AM EDT
Have you stored the tcpdump into a database??
If yes, Please explain how?
How do you convert tcpdump to csv data?
Thanks.
Former memberPosted Apr 14, 2009, 9:04 AM EDT
I have successfully added the dump file into my database....wat i did was
first i opened the dump file using Wireshark tool then i stored it as .csv file..hope this not a prob for u...
Then in c# i used the following code...
SqlCommand command = new SqlCommand();
command.Connection = con;
command.CommandText = "BULK INSERT snort.dbo.[IncomingDataset]" + @" FROM 'c:\wednesday'" + "WITH" + "(" + "FIELDTERMINATOR = ','," + "ROWTERMINATOR='\n'" + ")";
command.CommandTimeout = 300;
command.ExecuteNonQuery();
Console.WriteLine("--------Dataset loaded sucessfully-------\n\n");
stored in sql server 2005
Here snort.dbo is the database name
Incomingdataset is the table name
c:/wednesday is the csv file.....
Hope i made myself clear..any doubt lemme know...