29 Jan 2018 08:07
#include 'adodb.ch'
public conexao
** MODELO DE CONEXAO LOCAL
oConexao:=CreateObject("ADODB.Connection")
oConexao:open("DRIVER={MySQL ODBC 3.51 Driver};" + ;
"server=localhost" + ;
";database=BANCO_DE_DADOS" + ;
";uid=root" + ;
";pwd=")
oCursor:=CreateObject("ADODB.Recordset")
29 Jan 2018 10:41
29 Jan 2018 13:56
29 Jan 2018 18:01
29 Jan 2018 20:59
30 Jan 2018 20:49
// CONEXAO LOCAL
$conexao = mysql_connect("localhost","root","");
if (!$conexao)
header("Location: erro.htm");
// CONEXAO AO BANCO DE DADOS
$banco = mysql_select_db("banco_de_dados",$conexao);
if (!$banco)
// DIRECIONA A UMA PAGINA HTML DE ERRO
header("Location: erro.htm");
' MODELO DE CONEXAO COM MYSQL LOCALHOST
set conexao=Server.createObject("ADODB.connection")
conexao.Open = "Driver=MySQL ODBC 5.1 Driver; DATABASE=banco_de_dados; SERVER=localhost; UID=root; PASSWORD=;"
set RS = Server.CreateObject("ADODB.Recordset")
RS.open "SELECT * FROM tabela",conexao
RS.close
set RS = nothing
' DIRECIONA PAGINA DE ERRO, CASO NAO OCORRA A CONEXAO
if Err.number <> 0 then
response.Redirect("erroserver.htm")
response.end()
end if
%>
30 Jan 2018 22:47
Claudio Soto escreveu:No utilizo MySQL pero tal vez pueda ser de ayuda:
http://www.vbforums.com/showthread.php? ... pen-closed
30 Jan 2018 23:33
FUNCTION MySqlConnection( cServer, cDatabase, cUser, cPassword, nPort, nVersion )
LOCAL cnConnection
hb_Default( @nPort, 3306 )
hb_Default( @nVersion, AppODBCMySql() )
cnConnection:= win_OleCreateObject( "ADODB.Connection" )
cnConnection:ConnectionString := "Driver={MySQL ODBC " + iif( nVersion == 3, "3.51", "5.3 ANSI" ) + " Driver};Server=" + cServer + ";" + "Port=" + Ltrim( Str( nPort ) ) + ;
";Stmt=;Database=" + cDatabase + ";User=" + cUser + ";Password=" + cPassword + ";Collation=latin1;" + ;
"AUTO_RECONNECT=1;COMPRESSED_PROTO=0;PAD_SPACE=1" // usando compactação impede certas checagens // Option=131072;
cnConnection:CursorLocation := AD_USE_CLIENT
cnConnection:CommandTimeOut := 600 // seconds
cnConnection:ConnectionTimeOut := 600 // seconds
RETURN cnConnection