 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jeremy Collins Guest
|
Posted: Thu Aug 14, 2003 11:13 am Post subject: Re: Newbie Question About DB Connection via Internet |
|
|
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 |
|
 |
|
|
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
|
|