Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Problemi connessione a mysql in "localhost"

    ciao, ho fatto una ricerca nel forum ma senza risultati!
    Devo collegarmi da pagine asp ad Mysql in "localhost".
    Premetto che:
    1. ho installato il driver odbc scaricato dal sito di mysql;
    2. ho creato e testato "le connessioni" in: Strumenti di amministrazione --> Origine dati ODBC.

    Ho un file che si chiama config.inc e al suo interno c'è:
    codice:
    Dim MySQLSVR, MySQLPRT, MySQLUID, MySQLPWD, MySQLDB, MySQLOPT, DB_CONNECTIONSTRING, UploadPath, CSS
    ' UPDATE THESE VALUES for MySQL *******
    MySQLSVR = "localhost"	' enter IP or hostname of MySQL server
    MySQLPRT = 3306     ' enter MySQL port (default 3306)
    MySQLUID = "root"   ' enter Username (between quotes)
    MySQLPWD = "root"   ' enter Password (between quotes)
    MySQLDB  = "db"     ' enter Active DataBase (between quotes)
    MySQLOPT = 16387    ' enter MyODBC options values (at least 16387)
    ' END OF UPDATE ***
    ' MySQL Version
    DB_CONNECTIONSTRING = "driver={MySQL};server="&MySQLSVR&";port="&MySQLPRT&";"_
    & "uid="&MySQLUID&";pwd="&MySQLPWD&";database="&MySQLDB&";option="&MySQLOPT&""
    Nella mia bella index.asp faccio l'include:
    e faccio la mia bella query:
    codice:
    Dim rs , sql
    Set rs = Server.CreateObject("ADODB.Recordset")
    sql="select id from notizia where id=(select max(id) from notizia);"
    rs.Open sql, DB_CONNECTIONSTRING
    non scrivo ciò che segue perchè l'errore mi ferma qui...
    Questo l'errore:
    codice:
    Script error detected at line 805. Source line: rs.Open sql, DB_CONNECTIONSTRING 
    Description: [Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato.
    Uso Baby Web Server per far girare Asp in locale... IIS non mi funge!
    Aiuto!!!
    Ciao e grazie
    Stex
    stex1984

  2. #2
    risolto con questo codice:

    codice:
    Dim rs , sql , Conn
    Set rs = Server.CreateObject("ADODB.Recordset")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.ConnectionString = "DSN=db"
    Conn.Open
    ma non capisco perchè con l'altro metodo non funziona?
    stex1984

  3. #3
    Utente di HTML.it L'avatar di salvod
    Registrato dal
    Feb 2002
    Messaggi
    314
    forse perchè il driver con il nome MySQL non esiste.. ad esempio a me lo crea con il nome MySQL ODBC 3.51 Driver... prova a coambiare in...

    codice:
    DB_CONNECTIONSTRING = "driver={MySQL ODBC 3.51 Driver};server="&MySQLSVR&";port="&MySQLPRT&";"_
    & "uid="&MySQLUID&";pwd="&MySQLPWD&";database="&MySQLDB&";option="&MySQLOPT&""
    cercasi siti con 1000 accessi al giorno di media per testing servizio di statistiche professionale... per info pvt me

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.