Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2003
    Posts
    7

    Unhappy Unanswered: Connecting to MySQL from ASP

    Hi

    I am trying to connect to a MySQL server from ASP with the following

    set conn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")
    conn.Open "user=hullabulla;password=bulla;DSN=MySQL;DATABASE =hulla;SERVER=localhost;"
    rs.ActiveConnection = conn

    It does not work and a error is returned from

    ADODB.Connection.1 error '80004005'

    SQLState: IM002
    Native Error Code: 0
    [INTERSOLV][ODBC lib] Data source name not found and no default driver specified

    I am using a web hotel so I can't change any options on the server.

    Can you help me???
    Last edited by mcdyt; 10-29-03 at 14:42.

  2. #2
    Join Date
    Oct 2003
    Posts
    24
    Have you tryed to connect to the same DSN with another program (e.g. Excel) just to check if the ODBC works OK ??

    Just to get to the not working point.....


    H2O

  3. #3
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137
    Have you created a DSN named MySQL? Because ADO is complaining that you didn't. If you want to do a DSN-less connection, then you should use "Driver={MySQL ODBC 3.51 Driver};" and if your ODBC driver is older, try "Driver={MySQL};"

  4. #4
    Join Date
    Oct 2003
    Location
    Hollywood, FL USA
    Posts
    4

    Angry

    Hey fellas,

    I recently installed MySQL (version 4 I think). I'm running Windows XP Pro. I went into the command console (msdos) and created a database:

    creat table patients...

    I created a table too and tried to access it through ASP. It didn't work - please help. I'm a novice in connection.

    Code:
    strConnString = "driver={MySQL ODBC 3.51 Driver};server=localhost;database=patients;option=NUM"    
    Set dbConn = Server.CreateObject("ADODB.Connection")
    dbConn.Open strConnString
    Last edited by digitalalias; 11-06-03 at 07:11.

  5. #5
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137
    How are you trying to access it? Are you using straight SQL statements or ADO recordset objects (like a table source)?

    Originally posted by digitalalias
    ...
    I created a table too and tried to access it through ASP. It didn't work - please help. I'm a novice in connection.
    ...

  6. #6
    Join Date
    Nov 2003
    Posts
    17

    2 Strings

    DRIVER=MySQL ODBC 3.51 Driver;UID=hullabulla;STMT=;OPTION=;PORT=;PASSWORD =bulla;SERVER=remote;DATABASE=hulla;DESC=;
    DRIVER=MySQL ODBC 3.51 Driver;UID=hullabulla;STMT=;OPTION=0;PORT=;PASSWOR D=bulla;SERVER=localhost;DATABASE=hulla;DESC=;

    the two strings above are for dsn-less connections from ASP, we use the snot out of them where I work so it's a lot easier not to setup a DSN each time.

    That said, you need to have MyODBC 3.51.xx installed on the computer that will be accessing the data.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •