I am not sure whether this forum or the SQL forum is the best place to post my question. I did a search for my question in both forums and got no hits in either. I am currently using tcpdump to collect packet information, i found another programs that formats this information and it is written in c. I would like to go into that program and add some SQL calls to push the needed information to my SQL Server 2000 database. Can any of you guys point me in the direction of the syntax to do this. I did a search on google but haven't found a really good example to explain how this works. My databases name is group16 and my table is Host1Bandwidth. This table has various columns ( Host and Destination IP and MAC Addresses, port, protocol ,etc). I would just like the basic information to be able to add a SQL function in the C code to access the database, log in and push the information to the appropriate column in the table. Any help would be appreciated.
Sorry i forgot that i posted that on this forum earlier this month. The idea is essentially the same as before but now we are using tcpdump to capture the info. I downloaded the redhat rpms for iODBC. What do i need to do to set up the connection with my MS SQL database? Like i said before i have a rehdat box that is running tcpdump that is piped through a filter. That filter is written in C. I did a search for ODBC instructions and found a few turorials but i am still confused on how the whole connection works. If i add this to my C code:
what will happen? The name of my SQL server group is W2KServer, group 16 is the name of the database. By using the instruction above how does it know where group16 lives? Do i need to do some configuration through iODBC to make that connection? I found instructions on how to do this if my c program were running on windows and connecting to a MS SQL database (you can add the connection through the control panel), but i have been able to find anything if i am connecting to a MS SQL database on W2K server from a redhat 9 box.
Also i know that you mentioned that i need to push the information from tcpdump into a buffer first and then read from the buffer and outpt to the database, but i am not really sure how to do this. So i am going to concentrate on making the connection to the database first.
The Linux-speak for an asynchronous process is a "forked process". You usually start these using the fork() call.
Find out if your school has an approved or supported way for a RedHat box to connect to a SQL database. There are a couple of ways to do this, but they are radically different. I don't have any preference, so pick one that has local support and we can run with it. I'm not familiar with the RedHat iODBC code, so you'll need to find someone that knows how to use it.
You are correct, connecting to the database will be the challenge if you are using Linux instead of one of the Windoze based packet monitors. That is where you need to focus your efforts for now.