Board index » cppbuilder » Re: using application Service wih access to Database

Re: using application Service wih access to Database


2005-07-15 10:33:05 PM
cppbuilder113
Sorry I made a mistake in my last mail
I think that I 'm clear and the instruction Database1->connected=true is the
problem ; it makes an exception
Now I'd like to know how to debug application Service;if I run it in the
Ide, it stops after about 500 Ms so I can not start my service with the
panel
configuration .is there anything I don't do correctly?
 
 

Re:Re: using application Service wih access to Database

"Didier" < XXXX@XXXXX.COM >wrote in message
Quote
I think that I 'm clear and the instruction Database1->connected=true
is the problem ; it makes an exception
But you have not yet determined WHY it is throwing. So AGAIN, please use
the de{*word*81} to find out why. Otherwise, you will have to log the Exception
that is thrown and then view it separately, ie:
void __fastcall TMyService::ServiceStart(TObject *Sender, bool &Started)
{
try
{
Database1->Connected = true;
Started = true;
}
catch(const Exception &e)
{
LogMessage("Unable to connect ot database! " + e.Message,
EVENTLOG_ERROR_TYPE, 0, 0);
Started = false;
}
}
You can use the NT Event Log Viewer to view the message.
Quote
Now I'd like to know how to debug application Service
I already told you how to do that. Please go re-read my earlier message on
that.
Gambit
 

Re:Re: using application Service wih access to Database

Ok
I've done what you suggested me and I get the following Event:
"Unable to connect to database1 user or password unknown"
"unvailable database"
ALIAS MADATABASE
It's incredible because when I try and verify parameters of my TDatabse
Object there is no problem , I can connect to it (login prompt is set to
false and when I put the Active propriety to true there is no problem!!!!)
 

{smallsort}

Re:Re: using application Service wih access to Database

"Didier" < XXXX@XXXXX.COM >wrote in message
Quote
"Unable to connect to database1 user or password
unknown" "unvailable database"
Ok, now we are getting somewhere. Your database is unavailable. What kind
of database are you using exactly? Are you using BDE? Are you using TCP/IP
to connect to it? By default, services do not have access to the network,
so that may be affecting things.
Gambit
 

Re:Re: using application Service wih access to Database

My database is an interbase Database; I'm using the BDE ;
I don't use TCP/IP because my databse is on the same machine that the
application service ?
I want just to say agin that when I can connect to it during the conception
Thanks again for your help
 

Re:Re: using application Service wih access to Database

"Didier" < XXXX@XXXXX.COM >wrote in message
Quote
My database is an interbase Database
I'm using the BDE ;
I would strongly suggest you look at using the IBX components instead. IBX
uses the Interbase API directly. No need for the overhead of BDE at all.
Also, accessing the Interbase API directly, you can choose to use a TCP/IP
connection to the database engine, which will work better for a service
application, especially if the database is located remotely.
Quote
I don't use TCP/IP because my databse is on the same
machine that the application service ?
But, the BDE may be trying to access the network subsystem in order to
access the file via a UNC path.
Gambit
 

Re:Re: using application Service wih access to Database

Ok I'm going to try IBX Components but I'd like to know if there is an issue
in using BDE ?
 

Re:Re: using application Service wih access to Database

I've trying to use IBDatabase Object and I get nearly the same message:
Descriotion for event ID(0) in the source (Service) is unknown the local
computer doesn't have register informations or librariies to display
messages from the remote computer . you can perhaps use /auxsource to get
the description . read help and support for more details.
Following informations are in the event : Unable to connect to database
unavailable database.
note :n the previous message I haven't translated the beginninig ot the
error event .I think it has no importance
I should say that if I try in conception to connect to my databse there is
no problem so my IBDatabase Object is well parametered
I use local server
TCP/IP isn't available
user name=SYSDBA
password=masterkey
 

Re:Re: using application Service wih access to Database

"Didier" < XXXX@XXXXX.COM >wrote in message
Quote
Unable to connect to database unavailable database.
Did you verify that the database engine itself is actually running?
Interbase has services of its own. Did you try setting up your service to
have dependancies on them so that they will always be guaranteed to be
running before your own service starts?
Gambit
 

Re:Re: using application Service wih access to Database

the database engine is running becauxse I can coonect to ma database in
conception mode!
secundary, the interbase didn't run as service so I stopped in and r'estart
as a service.
I verified that the two services (Interbase 7.5 gds_db Server an Interbase
Guardian gds_db) were started
I put the dependancy (I'm not sur that it is the right methos, i put
"Interbase 7.5 gds_db Server" as the name of the dependancy 0)
But it always run wrong I get the same error , I can't connect to my
database . I think that the service runs as a thread and it didn't see the
database Object :don't you think so?
We have spend a lot otf time to uinderstand what it is wrong ; don't yout
think it would be more speedy you send me a very small example which shows
that we can connect to an interbase databse in an apllication Server
Thank you again
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >a écrit dans le message de news:
42db63f9$ XXXX@XXXXX.COM ...
Quote

"Didier" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>Unable to connect to database unavailable database.

Did you verify that the database engine itself is actually running?
Interbase has services of its own. Did you try setting up your service to
have dependancies on them so that they will always be guaranteed to be
running before your own service starts?


Gambit


 

Re:Re: using application Service wih access to Database

"Didier" < XXXX@XXXXX.COM >wrote in message
Quote
the database engine is running becauxse I can
coonect to ma database in conception mode!
The design-time editors do not operate in the same threading model that the
service will execute in at run-time. Just because the code can connect at
design-time does not necessarily mean it will be able to at run-time.
Quote
I think that the service runs as a thread
Yes, it does.
Quote
and it didn't see the database Object :don't you think so?
Possibly. Have you tried dynamically creating the database object at
run-time in the context of the service's thread, rather than dropping the
component onto the service's DataModule at design-time?
Quote
We have spend a lot otf time to uinderstand what it is wrong ; don't
yout think it would be more speedy you send me a very small example
which shows that we can connect to an interbase databse in an
apllication Server
No, because I don't have any spare time to develop that for you. All I can
tell you is that the IB components works just fine in services, so if you
cannot connect with them, then you are either not using them properly in the
first place, or your database is messed up, or something.
Gambit