30 users online (1 members and 29 guests)  


  Results 1 to 1 of 1

Related

  1. perl database connection problem    Forum: CGI Perl Forum
    Replies: 0
  2. how to set up Perl with MYSQL    Forum: CGI Perl Forum
    Replies: 0
  3. mysql connection sometime failed    Forum: Databases
    Replies: 16
  4. Perl Win32::ODBC Kerridge    Forum: Databases
    Replies: 9
  5. Perl dbi with mysql problem    Forum: CGI Perl Forum
    Replies: 1
  1. #1
    vivekkimi's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2008
    Posts
    2

    PERL-MYSQL connection using ODBC

    Hello,

    I have written a script in PERL, where i want to retrieve data from a database and the script seems to be fine but im not able to see the ou.

    Can u HELP me out..it says connection failed



    #!g:/perl/bin/perl.exe

    use Win32::ODBC;
    use CGI qw(:standard);
    print"content-type:text/html\n\n";

    print"<html>";
    print"<title> PROGRAM-5</title>";
    print"<body bgcolor=pink text=white size=2>";
    print"<font face=Pristina size=6>";

    print"<font face=Verdana color=black>";
    print"Program:5<br><br>";
    print"</font>";
    print"hi";

    use Win32::ODBC;
    $dsn= "dsn=insurance;uid=root;pwd=passwd;";

    if(!($con=new Win32::ODBC($dsn)))
    {print"CONNECTION FAILED";
    die"con failed";
    }
    $qry="select * from person;";
    $con ->sql($qry);

    while($con -> FetchRow())
    {
    %list=$con -> DataHash();
    $drid=$list{"drid"};
    print" Driver id=$drid";
    $name=$list{"name"};
    print" Name=$name";
    $ad=$list{"ad"};
    print" Address=$ad<br>";
    }


    print"</body>";
    print"</html>";
    Last edited by vivekkimi; 11-19-2008 at 11:44 AM.



Tags for this Thread