BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Newbie Question About DB Connection via Internet

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Jeremy Collins
Guest





PostPosted: Thu Aug 14, 2003 11:13 am    Post subject: Re: Newbie Question About DB Connection via Internet Reply with quote



Sheila Nelson wrote:

Quote:
I have several applications developed in Delphi 4 Client/Server that run
against a Microsoft SQL Server on our local area network. I need to
modify these applications so they connect to a SQL server via the
internet -- preferably without the client using a browser. I've
purchased the Enterprise version of Delphi 6. Is it possible to do what
I'm trying to do and, if so, can someone tell me which of the
internet-based components in Delphi 6 I would use? If I absolutely have
to use a browser, is there a method that would not require rewriting all
of my code in HTML? I'm not asking for a lot of detail -- just a little
push in the right direction.

You could try the "remote" ADO provider:

var
ConnectionString : string;
begin
:
ConnectionString := 'Provider=MS Remote;' +
'Remote Provider=sqloledb;' +
'Data Source=theserver;' +
'Initial Catalog=thedb;' +
'Remote Server=http://www.yourserver.com';
:
end;

It's basically a normal ADO connection string, but the provider is
now "MS Remote" and you delegate the *actual* provider to the "Remote
Provider" property.

-OR-

If the remote machine is set up as a web server, you could also use
Delphi's Internet components to execute some basic ASP scrips on the
server and get the results right into your application.

So a VERY basic ASP file could be:

--test.asp----------------------------------------------------------
Dim oCnn, oRS, strSQL

Set oCnn = Server.CreateObject("ADODB.Connection")
oCnn.Open "Provider=sqloledb;blah;blah"

strSQL = Request.QueryString(SQL)
Set oRS = oCnn.Execute(SQL)

while not oRS.EOF
' e.g. write the first two fields delimited with a pipe
Response.Write oRS(0).Value & "|" & oRS(1).Value & vbCrLf
oRS.MoveNext
wend
--------------------------------------------------------------------

If you used a Delphi HTTP component to connect to this URL:

http://mydomain.com/scripts/test.asp?SQL=SELECT * FROM COMPANIES

your application would get the data as plain text for you to parse.


--
jc

Remove the -not from email


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.