Board index » delphi » ADO connection

ADO connection


2003-10-23 06:49:08 PM
delphi247
Using D7, ADO & MS SQL 2000.
How do I detect if the connection is broken through for example a database
shutdown
or network fault?
Thanks.
Hendrik
 
 

Re:ADO connection

Quote
Using D7, ADO & MS SQL 2000.

How do I detect if the connection is broken through for example a database
shutdown
or network fault?
See "Connection Status" property of ADODB.Connection
 

Re:ADO connection

I'm sorry but I cannot find any documentation on a "Connection Status"
anywhere in ADODB.
The closest thing i could find resembling that is the State property of an
ADOConnection object. With periodic calls to check that property couldn't
one "watch" the database for disconnects and such.
"Kovalenko Dmitry" <XXXX@XXXXX.COM>writes
Quote
>Using D7, ADO & MS SQL 2000.
>
>How do I detect if the connection is broken through for example a
database
>shutdown
>or network fault?

See "Connection Status" property of ADODB.Connection

--
Dmitry Kovalenko
www.ibprovider.com

 

Re:ADO connection

Hey, guys I am converting a 4year old paradox database program to MS SQL 2000. So far everything going well, I want to trap when the server is disconnected, or lost connection. I can not seem to find any info on how to do it. I am sure its a event in the ADOConnection. Any help would be nice!
Thanks
 

Re:ADO connection

I looked for this too and couldn't find it. I ended up using a timer that
checks the connection periodically.
"Ken" <XXXX@XXXXX.COM>writes
Quote

Hey, guys I am converting a 4year old paradox database program to MS SQL
2000. So far everything going well, I want to trap when the server is
disconnected, or lost connection. I can not seem to find any info on how to do
it. I am sure its a event in the ADOConnection. Any help would be nice!
Quote

Thanks
 

Re:ADO connection

Ken, I have used the Connected Property of the ADOConnection the check if the
connection is true.
If ADOConnection1.Connected Then
Begin
// Do Something
End
Else
Begin
// Do Something else
End;
"darren" <XXXX@XXXXX.COM>writes
Quote
I looked for this too and couldn't find it. I ended up using a timer that
checks the connection periodically.

"Ken" <XXXX@XXXXX.COM>writes
news:3fb59600$XXXX@XXXXX.COM...
>
>Hey, guys I am converting a 4year old paradox database program to MS SQL
2000. So far everything going well, I want to trap when the server is
disconnected, or lost connection. I can not seem to find any info on how to
do
it. I am sure its a event in the ADOConnection. Any help would be nice!
>
>Thanks


 

Re:ADO connection

On 14 Nov 2003 18:57:04 -0700, "Ken" <XXXX@XXXXX.COM>writes:
Quote

So far everything going well, I want to trap when the server is disconnected,
or lost connection. I can not seem to find any info on how to do it.
<snip>
Ken,
this may seem like an odd question, but why do you need to know when
the connection has gone? By that I mean, what will you do with that
information? Your application will find out soon enough if you
try to query or post something back to the server. If you user isn't
doing anything at the moment (like working in another application
while yours is running) with your application then why do they care?
If all you are going to do is place the connected/disconnected
status on a status bar, for example, I don't see how this benefits
anyone. If the user is working with, say, an ADOClientDataSet they
can quite happily keep doing whatever they want to do with it until
post-back time, at which time you attempt to reconnect (perhaps
silently) and report failure then if unsuccessful.
Just askin',
Oz
 

Re:ADO connection

"Christopher Davis" <XXXX@XXXXX.COM>writes
Quote

Can you use an ADO Connection to connect to an access
database on an FTP site? If so, how should the connection
string be formatted?
I don't think the FTP protocol allows random access into a file. If it were
for read-only use, it would probably be faster to download it just once
anyway. If you need to write to the file, I don't think it would be
practical.
However, if you have some personal webspace provided by your ISP, you can
try it out if you're still curious. I have no idea what the connection
string would look like. I would try 'FILE NAME=ftpsite.udl' and use a UDL
file - easier to mess with on the fly.
Good luck!
--
Ray Marron
 

Re:ADO connection

Can you use an ADO Connection to connect to an access database on an FTP site? If so, how should the connection string be formatted?
 

Re:ADO connection

Hello,
I would like to move away from BDE to ADO.
Just a few questions.
1. Do I need to create an OBDC data souce and is this recomended.
2. In building the connection string for the adoconnection, what is the
best provider if I want to connect to MS SQL,
3, I assume that adoconnection replaces my TDatabase component.
Thanks in advance.
Sam
 

Re:ADO connection

"Sam G." <XXXX@XXXXX.COM>wrote in
Quote
Hello,

I would like to move away from BDE to ADO.
Just a few questions.
1. Do I need to create an OBDC data souce and is this recomended.
No you do not have to unless you are using ODBC for the conectivity.
Quote
2. In building the connection string for the adoconnection, what is
the best provider if I want to connect to MS SQL,
I use extensivly the Microst SQL server OLEDB Driver
with no problems so far.
Quote
3, I assume that adoconnection replaces my TDatabase component.
I haven't use BDE for years but in the sense that TDatabase
is the common access point for the rest of your datasets then
yes it is a replacement.
Regards
Yannis.
 

Re:ADO connection

I am using SQL Server 2000 and Delphi 5. If as a result of an event I run a
query on the database and for some reason the DB Server is down, can
somebody show me how I can recover from this so that the next time the query
is run and the DB Server is back, it runs without any problem. I
continuously get Connection Failure even when the DB Server is back. I have
tried to reset many different things in ADOConnection but so far without any
luck.
Thanks,
John
 

Re:ADO connection

No takers. Does this mean nobody ever does this or it is not possible. I
can't find any example of this on the internet.
John
"John McGill" <XXXX@XXXXX.COM>writes
Quote
I am using SQL Server 2000 and Delphi 5. If as a result of an event I run
a
query on the database and for some reason the DB Server is down, can
somebody show me how I can recover from this so that the next time the
query
is run and the DB Server is back, it runs without any problem. I
continuously get Connection Failure even when the DB Server is back. I
have
tried to reset many different things in ADOConnection but so far without
any
luck.

Thanks,

John


 

Re:ADO connection

Hi,
I'm trying to connect to acces database from delphi.
I tried different examples, but each time when I connect
appear ado login dialog and prompt me for a user and
password. After pressing OK without any input the connection is
created successfull.
How is possible to skip this dialog. I tried with different DB without
success - each time appear this dialog.
Also I have not installed access on my machine. Maybe this is the reason?
Thanks in advance!
best regards
Ivan Krastev
----------------------------------------------------------------------------
var
MyDBConnection : TADOConnection;
begin
// create the connection object
MyDBConnection := TADOConnection.Create(Application);
try
// set the connectionstring
MyDBConnection.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'
+ 'Data Source=' + PrgDir +
'pcbis_sort.mdb;'
+ 'Persist Security Info=False';
// open the connection
MyDBConnection.Open;
// do whatever you want with this connection
// (...)
// close the connection
MyDBConnection.Close;
finally
// in all cases, free the object
MyDBConnection.Free;
end;
end;
 

Re:ADO connection

Ivan Krastev writes:
Quote
I'm trying to connect to acces database from delphi.
I tried different examples, but each time when I connect
appear ado login dialog and prompt me for a user and
password. After pressing OK without any input the connection is
created successfull.

How is possible to skip this dialog. I tried with different DB without
success - each time appear this dialog.
TADOConnection has a property LoginPrompt, set it to False.
Quote
Also I have not installed access on my machine. Maybe this is the
reason?
No.
--
Pieter