Hi,
Just see the script below to figure you out how MC is, natively and without any
XCMD, DLL or so on, able to connect any SQL database server, using the Metatalk
built-in "POST" command :-)
To include to a cgi .mt script or an mc applications server app (second edition)
:
on QuerySQL
global Retour
set httpHeaders to "Content-Type: text/html" & cr & "Content-Length:" && the
length of "a=b" & cr & cr
post "a=b" to url "http://localhost/cndp/repmysql.php" # to connect MySQL
(Linux,Win32)
# post "a=b" to url "http://localhost/cndp/repaccess.asp" # to connect MS
ACCESS (Win32)
# post "a=b" to url "http://localhost/cndp/repmssql.asp" # to connect MS
SQLServer 6.5/7 (Win32)
set httpHeaders to ""
put "<HTML><HEAD>" & \
"<META HTTP-EQUIV='content-type' CONTENT='text/html;charset=iso-8859-1'>"
& \
"<META NAME='generator' CONTENT='Metacard'>" & \
"<META NAME='keywords' CONTENT='metacard linux apache php mysql winnt
mssql'>" & \
"<TITLE>Connexion METACARD/MSSQL via IIS4/PHP</TITLE>" & \
"</HEAD><BODY bgcolor='white' text='darkblue' background=''>" & cr & \
it & cr & "</BODY></HTML>" into Retour
end QuerySQL
to store in the httpd docs folder as "repmysql.php" :
<?
//$link = @mysql_pconnect ('localhost', 'py', 'py') or exit ();
$link = @mysql_pconnect ('localhost', '', '') or exit ();
mysql_select_db ('Citalis') or exit ();
$result = mysql_query ('SELECT COUNT(*) FROM Citations') or exit ();
if ($row = mysql_fetch_array ($result))
echo ('La base Citalis compte actuellement ' . $row[0] . ' auteurs !...');
else echo ('Comme un bug !');
mysql_free_result ($result);
?>
to store in the httpd docs folder as "repaccess.asp" :
<%
Dim objConn
Dim objRec
set objConn = Server.CreateObject ("ADODB.Connection")
set objRec = Server.CreateObject ("ADODB.Recordset")
objConn.Open "DSN=NOMENCL"
objRec.Open "la_Fonction", objConn, 0, 1, 2
while not objRec.EOF
response.write objRec("Telen_Fonction") & "<br>"
objRec.moveNext
Wend
objRec.close
objConn.close
set objRec = nothing
set objConn = nothing
%>
to store in the httpd docs folder as "repmssql.asp" :
<%
Dim objConn
Dim objRec
set objConn = Server.CreateObject ("ADODB.Connection")
set objRec = Server.CreateObject ("ADODB.Recordset")
objConn.Open "DSN=BNPRSQL;USR=SA;PWD="
objRec.Open "SELECT ARTITRE FROM T_PRODUIT WHERE FK_ID_MODE=2", objConn
while not objRec.EOF
response.write objRec("ARTITRE") & "<br>"
objRec.moveNext
Wend
objRec.close
objConn.close
set objRec = nothing
set objConn = nothing
%>
My two cents ;-)
Regards, Pierre Sahores
chef de projet cyberlibrairie
SNPIN - CNDP. 91, rue Gabriel-Peri
92120 Montrouge. Tél.: 01.64.45.05.33
Penser la part du rêve et
produire l'avantage compétitif.
Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.