Ciao a tutti,
ho un DB su un server MySQL linux posto nel mio ufficio, sto cercando di leggere i dati di un database utilizzando i lseguente codice pescato da una guida su HTML.it ma mi restituisce la pagina il seguente errore:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on '87.25.254.186' (10060)
/test.asp, line 12
Dove sarà il problema, chiedo un aiuto! Grazie anticipatamente! Saluti
Frank
codice:
<%
server.ScriptTimeout = 300 ' 5 minuti
database = "hrdlog"
inizioTempo = Timer()
'Apertura connessione database
sub dbConnect(objConn)
connectionstring = "driver=Mysql ODBC 3.51 Driver; DATABASE="& nomedb &";SERVER=xxx.xxx.xxx.xxx;Port=3306; UID=hrdlog;PASSWORD=12345671234"
set objConn = server.createObject("ADODB.Connection")
objConn.Open connectionstring
end sub
'Chiusura connessione database
sub dbDisconnect(objConn)
objConn.close
set objConn = nothing
end sub
call dbConnect(objConn)
'Conto le tabelle
tot_tables = 0
Set Rs = Server.CreateObject("ADODB.Recordset")
strTables = "SHOW TABLES FROM TABLE_HRD_CONTACTS_V01" 'Query standard di MySQL
Rs.Open strTables, objConn
if not rs.EOF then
do while not(rs.eof)
tot_tables = tot_tables + 1
rs.movenext
Loop
end if
rs.close
set rs = nothing
response.write "<html>"
response.write "<title>Mostra tabelle e campi</title>"
response.write "<body style=""font-family:verdana;font:10px;"">"
'Scorro le tabelle
Set Rs = Server.CreateObject("ADODB.Recordset")
strTables = "SHOW TABLES FROM Formazione" 'Query standard di MySQL
Rs.Open strTables, objConn
if not rs.EOF then
ReDim arr_tables(tot_tables)
t = 0 'Contatore tables (tabelle)
response.write "<table style=""font-family:verdana;font:11px;"">"
do while not(rs.eof)
'Formattazione tabella
if t mod 2 = 0 then
strSfondo="#CCCC00"
else
strSfondo="#CCCCFF"
end if
'Array tabelle
arr_tables(t) = rs(0)
response.write "<tr>"
response.write "<td style=""background:"& strSfondo &";"">"
response.write ">Tabella "& right("00"& t+1,2) &" --> "& rs(0) &""
Set Rs2 = Server.CreateObject("ADODB.Recordset")
strFields = "SHOW FIELDS FROM "& rs(0) 'Query standard di MySQL
Rs2.Open strFields, objConn
if not Rs2.EOF then
f = 0 'Contatore fields (campi)
Do while not Rs2.EOF
response.write "[*] Campo "& right("00"& f+1,2) &" --> "& rs2(0) &""
f = f + 1
rs2.movenext
Loop
end if
rs2.Close
set rs2=nothing
t = t + 1
rs.movenext
response.write "</td>"
response.write "</tr>"
loop
end if
rs.close
set rs = nothing
response.write "</table>"
response.write "
Tempo impiegato: "& (timer() - inizioTempo) &" secondi."
response.write "</body>"
response.write "</html>"
call dbDisconnect(objConn)
%>