Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: [help] web server and ado connection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [help] web server and ado connection

    hey everyone im building a web server in delphi 7 with my sql, and after i finish i tried conect my web server with data base, so i use one ado conection but when i run my web server the service stop... some one can give me a tips for use ado connection ...

  2. #2
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    The short and somewhat unhelpful answer on tips to use ADO might be don't

    On a more helpful note....

    Which web server components are you using, the Indy ones, or are you writing a CGI app or an ISAPI/Apache module?

    Are you creating one connection to the database and then using it when you process all the requests? Web servers are normally multi-threaded and you can get into a real mess if you're not handling ADO properly.

    So, can you give us some example code? Where you setup the connection, where you use it, that sort of thing?
    :: AthenaOfDelphi :: My Blog :: My Software ::

  3. #3
    so im using iis 7 , i creat new soap with cgi and with soap module... i creat some functions and some arrays ...

    array implemented in interface

    Tcustomer = class(Tremotable)
    private
    FcustUserName : String;
    FcustCode : String;
    FcustName : String;
    FcustInvoiceAddress : Tadress;
    FcustDeliveryAddress : Taddresses;
    FcustNIF : String;
    FcustLogged : String;
    FcustCurrentAcount : String;
    FcustCurrentAcountDocs : Tdocuments;
    FcustPendingOrders : Torders;
    published
    property custUserName : string read FcustUserName write FcustUserName;
    property custCode : string read FcustCode write FcustCode;
    property custName : string read FcustName write FcustName;
    property custInvoiceAddress : Tadress read FcustInvoiceAddress write FcustInvoiceAddress;
    property custDeliveryAddress : Taddresses read FcustDeliveryAddress write FcustDeliveryAddress;
    property custNIF : string read FcustNIF write FcustNIF;
    property custLogged : string read FcustLogged write FcustLogged;
    property custCurrentAcount : string read FcustCurrentAcount write FcustCurrentAcount;
    property custCurrentAcountDocs : Tdocuments read FcustCurrentAcountDocs write FcustCurrentAcountDocs;
    property custPendingOrders : Torders read FcustPendingOrders write FcustPendingOrders;
    end;


    and i try use in webmodule ado querys and ado connection for use in my function on the implementation

    exemple..

    function Twebserver.Login(AUserName, APassword: string) : Tcustomer;
    VAR
    lista_info: Tcustomer;

    begin

    lista_info := tcustomer.create;

    //////////////login success///////////////////////////////////
    // D.qUtilizadores.SQL.Clear;
    webmodule.adologin.SQL.Text:='Select codentidade, nome, nipc, web_passwd from entidades where codentidade='''+AUserName+''' and web_passwd='''+APassword+'''';

    result := lista _info
    exit;


    and in my client when i active the ado connection i got erro 500 in browser wsl and login in client dont work, he dont enter....

  4. #4
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    I'm sorry if I ask a dumb question... do you know how to do normal file handling in Delphi? If you're getting a 500 error then your CGI is probably excepting, you're going to need to find out what the exception message is before you go any further.

    Simplest way would be to create a log file, and wrap the connection activation in a try..except block, capture the exception and write the message out to your log file. Let me know if you'd like some example code for this.

    Without knowing what's going on when you try the connect, it's a complete guessing game.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  5. #5
    ok i have ado querys and in design and i use this
    webmodule.adologin.SQL.Text:='Select codentidade, nome, nipc, web_passwd from entidades where codentidade='''+AUserName+''' and web_passwd='''+APassword+'''';
    webmodule.adologin.SQL.open;

    dont have nothing more in my query....
    in my client im using this ....

    var rest:tcustomer;

    begin
    try
    result := (httprio as iwebserver).login(edit1.text, edit2.text);
    except
    on e:exception do
    showmessage(E.message);
    end;
    end;

  6. #6
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    It's impossible to follow exactly what's going on from the snippets you're posting I'm afraid.

    Is the code part of a commercial project or is it something you'd just rather not get out into the wider world?

    If not, then my suggestion is ZIP it ALL up (and I mean everything, server, client, everything) and either attach it here or if you don't want it to be public, mail it to me (athena at pascalgamedevelopment dot com) and I'll take a look at it.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  7. #7
    yeah i know but only apear this error when my ado connection are true and i build the web server if he stay false my webserver run normaly..

  8. #8
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    You're going to need to grab the exception that's being raised when you're connecting to the database I'm afraid before I can provide advice on how to fix it.

    Dumb question time again... at design time, can you connect to the database using the ADOConnection object? Have you turned off the 'Login Prompt' (I think the property is LoginPrompt - set it to false if you haven't already).
    :: AthenaOfDelphi :: My Blog :: My Software ::

  9. #9
    i will send plz check it ... and tanx

  10. #10
    yup i can connect at the desing and login are false im using drives odbc may be this is the problem

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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