Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread "Connection test"
Wed, Apr 25 2007 9:27 AMPermanent Link

"Petter Topp"
Hello,

I'm trying to produce some generic code ("Connection" unit) for connecting
to either a Local or Remote database at runtime (The unit will be used by
several different applications). After having initialized the Session object
with connection properties, I wish to test wheter the provided properties is
correct. One way to find out, is to try to open a table, but I  don't know
wich table to open.
If the test fails, I would like to handle this within the "connect" unit.

How can I test the connection to a database given the situation above?
Any other way around this?

Thanks
Petter Topp
ATC Data
BDS 2006, Dbisam 4

Wed, Apr 25 2007 10:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Petter

If you are saying you don't know which tables are there use the sessions GetTableNames method.


If, on the other hand, you're saying you don't know which table to choose you're on your own Smiley

Roy Lambert
Wed, Apr 25 2007 2:26 PMPermanent Link

"Robert"

"Petter Topp" <petter.topp@atcdata.no> wrote in message
news:26DCC041-6C28-44CC-B595-B440C8563B15@news.elevatesoft.com...
>
> How can I test the connection to a database given the situation above?

What's wrong with

try
Session.Open;
except

Robert

Wed, Apr 25 2007 5:08 PMPermanent Link

"Petter Topp"
Hi Roy, thank you for your reply, I guess I'm on my own then...

I'm really looking for some ideas on how to verify that the correct database
is chosen.
One solution would be to add a datamodule to this "connection" unit with a
dummy table that I can open to test.

Petter


"Roy Lambert" <roy.lambert@skynet.co.uk> skrev i melding
news:8F37FD97-373B-47A6-A081-875CF4FAA29A@news.elevatesoft.com...
> Petter
>
> If you are saying you don't know which tables are there use the sessions
> GetTableNames method.
>
>
> If, on the other hand, you're saying you don't know which table to choose
> you're on your own Smiley
>
> Roy Lambert
>

Wed, Apr 25 2007 5:11 PMPermanent Link

"Petter Topp"
Hi Robert,

Session.Open is fine, but it will not verify that the correct table(s) are
in place...

Petter

"Robert" <ngsemail2005withoutthis@yahoo.com.ar> skrev i melding
news:DC87FF32-C24D-4F1D-879A-FC5C713A25E7@news.elevatesoft.com...
>
> "Petter Topp" <petter.topp@atcdata.no> wrote in message
> news:26DCC041-6C28-44CC-B595-B440C8563B15@news.elevatesoft.com...
>>
>> How can I test the connection to a database given the situation above?
>
> What's wrong with
>
> try
> Session.Open;
> except
>
> Robert
>
>

Wed, Apr 25 2007 10:58 PMPermanent Link

"Robert"

"Petter Topp" <petter.topp@atcdata.no> wrote in message
news:2DA1A99F-9445-4AC5-8C95-DC01D6231E90@news.elevatesoft.com...
> Hi Robert,
>
> Session.Open is fine, but it will not verify that the correct table(s) are
> in place...
>

table.exists

Robert


Thu, Apr 26 2007 2:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Petter


What are you looking for to determine if the correct tables are there? Session.GetTableNames will give you a list of the tables, but if I interpret your response correctly you could have several databases with these sets of tables and you want to make sure the right one is chosen.

If that's the case then its a matter of what's in the tables, and unless you have one of them with some content that says "yes this is the database" you've had it.


Roy Lambert
Thu, Apr 26 2007 3:40 AMPermanent Link

"Petter Topp"
Hi Robert,

Great suggestion, I will look at this.

Petter
"Robert" <ngsemail2005withoutthis@yahoo.com.ar> skrev i melding
news:6C6499D4-451C-4076-8404-74C12EE17A20@news.elevatesoft.com...
>
> "Petter Topp" <petter.topp@atcdata.no> wrote in message
> news:2DA1A99F-9445-4AC5-8C95-DC01D6231E90@news.elevatesoft.com...
>> Hi Robert,
>>
>> Session.Open is fine, but it will not verify that the correct table(s)
>> are in place...
>>
>
> table.exists
>
> Robert
>
>
>

Thu, Apr 26 2007 3:58 AMPermanent Link

"Petter Topp"
Roy

You are right on, I have several databases, and I really don't want to put
any of this knowledge into this "database connection" unit.
Robert suggested that I could use the Table.Exists Function, it's not
perfect, but at least I can see if the correct tables are in place.
If by some reason the tables are of wrong version or other discrepancy, I
will handle this outside the "Connection" unit.

Thank you  very much for your suggestions.

Petter


"Roy Lambert" <roy.lambert@skynet.co.uk> skrev i melding
news:10B2FCA1-2ECC-40FA-A660-2E1990D1F45F@news.elevatesoft.com...
> Petter
>
>
> What are you looking for to determine if the correct tables are there?
> Session.GetTableNames will give you a list of the tables, but if I
> interpret your response correctly you could have several databases with
> these sets of tables and you want to make sure the right one is chosen.
>
> If that's the case then its a matter of what's in the tables, and unless
> you have one of them with some content that says "yes this is the
> database" you've had it.
>
>
> Roy Lambert
>

Image