🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #57

Re: Send a username/password to the DataSnap-Server

#57
From: vavan
Date: Wed, 31 Mar 2004 07:29
45 lines
2754 bytes
On 30 Mar 2004 16:27:55 -0800, "Sydney Delieu" <syddel@hotmail.com>
wrote:

>    m_DataModule->adoConn->ConnectionString = "";
>
>    ws = "Provider=SQLOLEDB;User ID=";
>    ws = ws + UserName;
>    ws = ws + ";Password=" + Password;
>    ws = ws + ";Persist Security Info=false;";
>    ws = ws + "Initial Catalog=HBBB;";
>    ws = ws + "Data Source=127.0.0.1;";
>    ws = ws + "User Procedure for Prepare=1;Auto Translate=True;";
>    ws = ws + "Packet Size=4096;Workstation ID=RepAppServer;";
>    ws = ws + "Use Encryption for Data=False;";
>    ws = ws + "Tag with column collation when possible=False";
>
>    m_DataModule->adoConn->ConnectionString = ws;
>    m_DataModule->adoConn->Connected = true;

instead of somewhat awkward method of concatenating parts of
connection string one can simply use .udl file to set it up

    m_DataModule->ADOConnection->LoginPrompt=0;
    m_DataModule->ADOConnection->ConnectionString=String("FILE
NAME=")+ExtractFilePath(Application->ExeName)+"MyConnection.udl";
    m_DataModule->ADOConnection->Open(UserName,Password);

had you done that you do not need to recompile appserver in order to
change some connection settings

just a hint though :)

>    if (TempInterface.UserLogon(
>        AnsiToOLESTR(txtUsername->Text.c_str()),
>        AnsiToOLESTR(txtPassword->Text.c_str())) != S_OK) {

another hint is to use WideString variables instead of manually
convert parameters to pass them to COM object

and third (and last) is to implement ISupportErrorInfo interface in
your appserver to let pass exception info back to the client and show
there instead of mysterious "There was a problem" ;)

--
Vladimir Ulchenko aka vavan
Technical Details
Message-ID: <k6sk60thp9enud7b73akafmajf4se7nlqr@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!border1.nntp.ash.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40644ae9$1@newsgroups.borland.com> <406a108b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,2bd86f456036fab5
X-Google-Attributes: gidfcd2b,public
X-Google-ArrivalTime: 2004-03-30 23:38:28 PST
From: vavan <vavan@santel.ru>
Newsgroups: borland.public.cppbuilder.database.multi-tier
Subject: Re: Send a username/password to the DataSnap-Server
Date: Wed, 31 Mar 2004 11:29:45 +0400
Organization: TAIF-TELCOM
Message-ID: <k6sk60thp9enud7b73akafmajf4se7nlqr@4ax.com>
References: <40644ae9$1@newsgroups.borland.com> <406a108b$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 195.85.238.75
X-Trace: newsgroups.borland.com 1080718237 195.85.238.75 (30 Mar 2004 23:30:37 -0800)
Lines: 45
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!border1.nntp.ash.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail