Board index » delphi » I dont see the name of the Database from a thread

I dont see the name of the Database from a thread

Hi!

I have a database component on a DataModule. (the DatabaseName propery of it
is "DB")
I'd like to run a query in a thread, witch uses the same database than
themain program.
I created a session and a query object for the thread, but I couldn't set
the DatabaseName property of the query.
It doesn't find the "DB" name database, and the "database" property is read
only so I can't set it.
I created a database component for the session dynamicly, and the query
works with that fine,
but I use transactions in the main thread, and the query see just the
commited transactions.
I don't want the other programs to see the changes before I commit the
transactions, but I want the thread to see it.
I think i have to use the database on the Datamodul, but I can access it.
What can I do?

thanks:
Gabor
ps. Sorry because of my bed English

 

Re:I dont see the name of the Database from a thread


You not only have to create a TSession and a TQuery component for the
thread, but also a TDatabase component !

"Verebes Gbor" <vere...@freemail.hu> schreef in bericht
news:3a8c5301@andromeda.datanet.hu...

Quote
> Hi!

> I have a database component on a DataModule. (the DatabaseName propery of
it
> is "DB")
> I'd like to run a query in a thread, witch uses the same database than
> themain program.
> I created a session and a query object for the thread, but I couldn't set
> the DatabaseName property of the query.
> It doesn't find the "DB" name database, and the "database" property is
read
> only so I can't set it.
> I created a database component for the session dynamicly, and the query
> works with that fine,
> but I use transactions in the main thread, and the query see just the
> commited transactions.
> I don't want the other programs to see the changes before I commit the
> transactions, but I want the thread to see it.
> I think i have to use the database on the Datamodul, but I can access it.
> What can I do?

> thanks:
> Gabor
> ps. Sorry because of my bed English

Re:I dont see the name of the Database from a thread


Quote
> You not only have to create a TSession and a TQuery component for the
> thread, but also a TDatabase component !

I created, but I can't set the transactions,
because I have to see the changes in the thread before commiting the
transaction,
but I don't want others outside to see the changes until I commit the
transaction.
When I change something in the main program, the thread's database can't see
the changes.
If  I set the transaction of then main program's database to show every
changes immediately,
the changes will be visible outside also.

Quote
> > Hi!

> > I have a database component on a DataModule. (the DatabaseName propery
of
> it
> > is "DB")
> > I'd like to run a query in a thread, witch uses the same database than
> > themain program.
> > I created a session and a query object for the thread, but I couldn't
set
> > the DatabaseName property of the query.
> > It doesn't find the "DB" name database, and the "database" property is
> read
> > only so I can't set it.
> > I created a database component for the session dynamicly, and the query
> > works with that fine,
> > but I use transactions in the main thread, and the query see just the
> > commited transactions.
> > I don't want the other programs to see the changes before I commit the
> > transactions, but I want the thread to see it.
> > I think i have to use the database on the Datamodul, but I can access
it.
> > What can I do?

> > thanks:
> > Gabor
> > ps. Sorry because of my bed English

Re:I dont see the name of the Database from a thread


BDE sessions and databases are not thread-safe, so it is not allowed to use
the database in both the main and the query thread. That is why you need to
create separate sessions and databases for every thread.
You might be able to find a BDE replacement that does support thread-safe
databases (see http://www.kylecordes.com/bag/index.html).

"Verebes Gbor" <vere...@freemail.hu> schreef in bericht
news:3a92d7ac@andromeda.datanet.hu...

Quote
> > You not only have to create a TSession and a TQuery component for the
> > thread, but also a TDatabase component !

> I created, but I can't set the transactions,
> because I have to see the changes in the thread before commiting the
> transaction,
> but I don't want others outside to see the changes until I commit the
> transaction.
> When I change something in the main program, the thread's database can't
see
> the changes.
> If  I set the transaction of then main program's database to show every
> changes immediately,
> the changes will be visible outside also.

> > > Hi!

> > > I have a database component on a DataModule. (the DatabaseName propery
> of
> > it
> > > is "DB")
> > > I'd like to run a query in a thread, witch uses the same database than
> > > themain program.
> > > I created a session and a query object for the thread, but I couldn't
> set
> > > the DatabaseName property of the query.
> > > It doesn't find the "DB" name database, and the "database" property is
> > read
> > > only so I can't set it.
> > > I created a database component for the session dynamicly, and the
query
> > > works with that fine,
> > > but I use transactions in the main thread, and the query see just the
> > > commited transactions.
> > > I don't want the other programs to see the changes before I commit the
> > > transactions, but I want the thread to see it.
> > > I think i have to use the database on the Datamodul, but I can access
> it.
> > > What can I do?

> > > thanks:
> > > Gabor
> > > ps. Sorry because of my bed English

Other Threads