LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-20-2012, 02:49 PM   #1
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Rep: Reputation: Disabled
Question Do DBMS apis like MySQL run as CGI?


Sincw i was told that for webserver apis in c or c++ its used the CGI, I was wondering if MySQL itself runs as a cgi.

But I wouldnt think so. As I've red, a cgi api executes only for 1 page load, it starts up and it ends wright after. I don think this happens with MySQL. Its like an independent server always activated.

So what is it actualy MySQL - from the application aspect?

Idea: Maybe they a CGI just transfers them the string, then gets back the array reply, and sends it back to httpserver as an html for. Mayne it is done this way?

Last edited by esgol; 11-20-2012 at 02:55 PM.
 
Old 11-21-2012, 08:08 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,376

Rep: Reputation: 147Reputation: 147
CGI is a standard for web servers to pass requests to be processed by an external program. These programs respond by returning html which the web server will send back to the browser. A (relational) database will take an SQL query and return the result set. So they are very different beasts. You will find lots of libraries which interface with MySQL and will return the result set in a structure native to the language of your choice. Very crudely MySQL is a server with a listening port waiting for requests to arrive, it will the create a child process to actually manage the request whilst the server continues listening for more requests.
 
1 members found this post helpful.
Old 11-21-2012, 08:33 AM   #3
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Wow perfect exactly as I imagined!

So to make an odbc driver, you just have to do CGI api into the HttpServer (e.g. Apache)
which
will just open a socket towards the port that the DBMS server listen, send him the SQL string and take back the answer table. Is it true?

Some told me that I can open sockets with Php scripts also, so I will have no need to create a C CGI api.

Is it also true that I can open sockets with PhP?

P.S.
I have created a simple dbms and want to 'internetize' it

Last edited by esgol; 11-21-2012 at 08:49 AM.
 
Old 11-21-2012, 08:40 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,376

Rep: Reputation: 147Reputation: 147
PHP has a number of native MySQL libraries. With one of those libraries you will establish a connection to the MySQL server and that connection will remain open for the duration of the PHP script. You can open sockets with PHP but it isn't necessary, just use the MySQL library.
 
1 members found this post helpful.
Old 11-21-2012, 08:56 AM   #5
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
So i can open sockets with Php, PERFECT!

No I want to open sockets with PhP cause this is not about MySQL,I've created a personal DBMS in C/C++ and want to 'Internetize' it after I've planted the code inside a Multiclient Forked server listening to a port.

So i guess it another thread asking how to open sockets in PhP, maybe nor even for linuxquestions.org

Thank you so much!
 
Old 11-21-2012, 09:42 AM   #6
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,376

Rep: Reputation: 147Reputation: 147
Look here: http://php.net/manual/en/book.sockets.php
 
1 members found this post helpful.
Old 11-21-2012, 09:58 AM   #7
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Wooow! Thaaanks!!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Implement POSIX Semaphore APIs using System V Semaphores APIs LXer Syndicated Linux News 0 10-16-2012 08:30 AM
[SOLVED] how to add some compiler flags in code blocks IDE for Mysql headers and APIs golden_boy615 Programming 3 07-16-2011 01:57 AM
[SOLVED] how to add some compiler flags in code blocks IDE for Mysql headers and APIs golden_boy615 Programming 2 07-14-2011 12:47 AM
Cant seem to run any cgi scripts in cgi-bin folder, confused? j.smith1981 Linux - Server 5 02-14-2011 05:38 AM


All times are GMT -5. The time now is 03:53 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration