[AWS] GET Form and Database

DUCOS Frédéric fducos@noos.fr
Sun, 01 Jun 03 17:46:00


Hi all,

Into a callback function, I try to connect to a database (ODBC) in order to check user/pwd from an user form (in GET method) but the server does not response to the client (TimeOut).
However, in an independant program, this code (concerning database) run in 1 second.

Anybody knows a solution on this problem ?

Could you please find below the callback function and the HTML form.

Thanks in advance for you help.

Regards,

Frederic


with Databases;
[...]

package body Cgtp_Cb is

   use Aws;

   function Get (
         Request : in     Status.Data ) 
     return Response.Data is 

      if URI = "/auth-form" then

         declare
            Cgtp  : aliased Databases.Database;  
            Query : Databases.Select_Statement (5);  

            Login    : String (1 .. 15);  
            Password : String (1 .. 30);  
            Nom      : String (1 .. 50);  
            Prenom   : String (1 .. 50);  
            Niveau   : Positive;  

         begin
            Databases.Connect (Cgtp, "cgtp", "test", "test");

            Databases.Bind (Query, 1, "login", Login (Login'First)'Address, Login'Length, Databases.Sql_Char);
            Databases.Bind (Query, 2, "password", Password (Password'First)'Address, Password'Length, Databases.Sql_Char);
            Databases.Bind (Query, 3, "nom", Nom (Nom'First)'Address, Nom'Length, Databases.Sql_Char);
            Databases.Bind (Query, 4, "prenom",Prenom (Prenom'First)'Address, Prenom'Length, Databases.Sql_Char);
            Databases.Bind (Query, 5, "niveau", Niveau'Address, 0, Databases.Sql_Integer);

            Databases.Query (Query, 1, Databases.Equal, "admin");

            Databases.Sql_Select (Cgtp, Query, Table => "Users");

            Databases.Close (Cgtp);

            return Response.Build
              (Content_Type => "text/html",          
               Message_Body => "<p> Form done !</p>");

         exception
            when E : others =>
               Databases.Close (Cgtp);

               return Response.Build
                 (Content_Type => "text/html",                                                                         
                  Message_Body => "<p>Problème de Liaison ODBC ... : " & Ada.Exceptions.Exception_Message (E) & "</p>");

         end;

-----------

Form send to the AWS server

<form method="GET" action="/auth-form">
  <div align="center">
    <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" width="274">
      <tr>
        <td align="left" width="120">Nom d'utilisateur</td>
        <td align="center" width="151">
        <p align="left"><input type="text" name="username" size="20"></td>
      </tr>
      <tr>
        <td align="left" width="120">Mot de passe</td>
        <td align="center" width="151">
        <p align="left"><input type="password" name="password" size="20"></td>
      </tr>
    </table>
    </center>
  </div>
  <p align="center"><input type="submit" value="OK" name="send_auth"></p>
</form>