odbc connection not work in asp connection RRS feed

  • Question

  • User2048558320 posted

    hi Guys,

    I know this is a .net forum but you guys have great all round knowledge and the best answers.

    Ive got a classic asp page which im trying to connect to a mysql db with - Ive installed iis 6, setup an odbc connection to the database and tested the connection so it does work, but when i run the index.asp page in explorer nothing displays and no errors coming up even through ive turned all that stuff on in iis manager. below is the code, hope you guys can help me problem solve.

    O and there is no query because as it stands it doesnt even show the text in the body tag as you can see below in the explorer source code

    Set my_conn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    my_conn.Open "DSN=testdb"
    Source code of page in explorer
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
    Thursday, October 22, 2009 9:57 AM

All replies

  • User-823196590 posted

    That's OK, we specifically have a classic ASP forum for these types of questions.

    Please share your index.asp code ...

    Thursday, October 22, 2009 10:04 AM
  • User989702501 posted

    Easier way to troubshoot this is to put some debugging code in your script, say response.write "set odbc connect', then execute query xyz.. then output. we need to know where it break, does it even reach the db etc.


    Thursday, October 22, 2009 10:05 AM
  • User2048558320 posted

    Thanks for such a quick response - asp code below - could it be something to do with permissions in iis

    Set my_conn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    my_conn.Open "DSN=testdb"
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>

    O and if i remove my_conn.open "DSN=testdb" it runs and shows the body content in explorer

    Thursday, October 22, 2009 10:07 AM
  • User-823196590 posted

    Did you create a system dsn? 

    Actually it would be better to use a non-dsn connection, then we can see the specifics of your connection string.


    Thursday, October 22, 2009 10:17 AM
  • User2048558320 posted

    yeah the top one worked so thank you, why is the odbc connection not working then?? any ideas

    Thursday, October 22, 2009 10:37 AM
  • User989702501 posted

    No error msgs or so? it is tough to know what went wrong without error msgs.


    Thursday, October 22, 2009 10:43 AM
  • User2048558320 posted

    im getting no errors at all, but when i try to use anything to do with ADODB.Connection it doesnt work and only displays a blank page with no errors to help.

    This is absolute rubbish, its prob vista's fault, soon as i get home im going to try xp and i bet it will work fine

    Thursday, October 22, 2009 11:36 AM
  • User989702501 posted
    MM... maybe you can try enable details error msgs for asp. http://blogs.msdn.com/rakkimk/archive/2007/05/25/iis7-how-to-enable-the-detailed-error-messages-for-the-website-while-browsed-from-for-the-client-browsers.aspx
    Saturday, October 24, 2009 9:38 AM
  • User2048558320 posted

    the problem was in the odbc connection, in the tutorial i followed they never said which DSN to use so ive been using User DSN instead of System DSN.

    Sorry for waiting your time.

    Monday, October 26, 2009 4:44 AM
  • User989702501 posted
    Ohh.. so the odbc connection is pointing somewhere else? .....
    Monday, October 26, 2009 10:29 PM