Hi. plz tell me how I can connect to an SQL server to an microcontroller or a PC using C language....
Plz reply soon....

Recommended Answers

All 11 Replies

How would begin by you demonstrating that you have done something so far (say STFW) or some indication of your skill level.

There is for example no point in explaining anything about SQL if you've yet to master simple "hello world" programs in C.

How would begin by you demonstrating that you have done something so far (say STFW) or some indication of your skill level.

There is for example no point in explaining anything about SQL if you've yet to master simple "hello world" programs in C.

i have worked in C language ..
just needed some info as to how do i go abt in connecting to a sql server..
hav wrked in c on a beginners level...
hope u'll be able to help me out...

study these google links about ODBC. There are other ways depending on which SQL server you are using but ODBC is the most portable and is supported by most, if not all, SQL servers today. ODBC, as well as other methods, are somewhat complicated and accessing in c++ is a lot easier because you can get free c++ classes on the net that do most of the work.

Hi again..
i'll be using an sql server 2005 and a microcontroller based system.
s microcontroller does not support any other programming language than c and assembly language.
hope this information will be help u guide me...

I'd say you have a very big problem then. If the sql server is running on another computer (which it probably does) then your microcontroller and the hardware it runs on will have to support sockets and have a lan card, much like a pc that's connected to a network. If your microcontroller does not support that then you are SOL.

Ye. it will be a kit with ethernet chip n rj45 connections.therefor the tcp/ip protocols needed will be taken care of..
nw i need to program my controller using c language in a way that i can access my sql server 2005 on a remote machine...Also im trying to find out if keil compiler supports vc++, since i know that sql can be connected using this language...
plz reply...

So could you for example write a C program on another PC which connects to your SQL server?

Prototyping your ideas on a PC first will save you a hell of a lot of time.

Something simple, like login, retrieve a record, logout.

Since you've stated that you're only a beginner, this is going to be a lot of hard work.

I'm also going to assume that the embedded target doesn't come with the same kind of SQL library that a PC might.

>>Also im trying to find out if keil compiler supports vc++, since i know that sql can be connected using this language...

vc++ is NOT a computer language -- it is a compiler.

can anyone pls send me the code to connect sqlserver to vc++

Didn't you even bother to read this thread? No one here is going to write the code for you.

Ye. it will be a kit with ethernet chip n rj45 connections.therefor the tcp/ip protocols needed will be taken care of..
nw i need to program my controller using c language in a way that i can access my sql server 2005 on a remote machine...Also im trying to find out if keil compiler supports vc++, since i know that sql can be connected using this language...
plz reply...

Then i think most simple way to achieve this is:
1. run your own web server somewhere on net.
2. connect web server to SQL database through PHP or other methods.
3. make HTTP calls (POST/GET) from your ethernet chip to that web server.

So that is communication will be =>
your controller <-> http server <-> sql server

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.