BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How get attachment ID

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express)
View previous topic :: View next topic  
Author Message
maxi
Guest





PostPosted: Mon May 07, 2007 10:22 pm    Post subject: How get attachment ID Reply with quote



Hi,
How can get the attachemnt ID using IBX 6.08 against Interbase 7.5 ?

I'am using a datasnap server and I want match client datasnap connection
with datasnap server (interbase) connection.


Thanks in advance.
M.
 



--- posted by geoForum on http://delphi.newswhat.com
Back to top
Craig Stuntz [TeamB]
Guest





PostPosted: Mon May 07, 2007 10:24 pm    Post subject: Re: How get attachment ID Reply with quote



maxi wrote:

Quote:
How can get the attachemnt ID using IBX 6.08 against Interbase 7.5 ?

Get the transaction ID. IBX has a property for this, although I'm not
sure if it was in 6.08 or was added later. JOIN TMP$TRANSACTIONS
against TMP$ATTACHMENTS to get the attachment ID.

That said, what you're attempting to do doesn't sound like a great
design. It would be better to use a session ID, IMHO.

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Please read and follow Borland's rules for the user of their
server: http://support.borland.com/entry.jspa?externalID=293
Back to top
Craig Stuntz [TeamB]
Guest





PostPosted: Mon May 07, 2007 11:45 pm    Post subject: Re: How get attachment ID Reply with quote



You should not care which attachment each request uses if your app
server is stateless. Session state should be stored in the database so
that any attachment can access it.

Try this:

1) When a new user connects, generate a session ID.
2) When you need data which is specific to that session, write a stored
procedure which accepts a session ID and returns session-specific data.

Now you can get the right data from /any/ attachment.

If you need the same attachment for every request from a certain
client, then your app server is stateful and you could have scalability
problems.

Puedes escribir tus preguntas en español si prefieres.

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Useful articles about InterBase development:
http://blogs.teamb.com/craigstuntz/category/21.aspx
Back to top
maxi
Guest





PostPosted: Tue May 08, 2007 12:07 am    Post subject: Re: How get attachment ID Reply with quote

Hi Craig, thans for you reply

I will try to explain this,
When a datasnap server is connected to Database, this use the same user
all time. Is the same user ever but distinct attachment ID (the datasnap
server is apartment-multithread).
If I query to Interbase monitor with, for intance, this sql statement:

select TMP$ATTACHMENT_ID as "Attachment ID",
TMP$DATABASE_ID as "Database ID",
TMP$USER as "User Name",
TMP$USER_IP_ADDR as "User IP",
TMP$USER_HOST as "User Host",
from TMP$ATTACHMENTS

I get ever the same user name but distinct Attachment ID of course. Then,
when a datasnap client is connected to server, he get a session ID but i
need know which attachment ID is matching.


Maybe I've a design concept problem or maybe my english is very bad Sad
and I'dont be clear.

Thank for you help.





Quote:
Craig Stuntz wrote:

.....

That said, what you're attempting to do doesn't sound like a great
design. It would be better to use a session ID, IMHO.




--- posted by geoForum on http://delphi.newswhat.com
Back to top
Craig Stuntz [TeamB]
Guest





PostPosted: Tue May 08, 2007 12:40 am    Post subject: Re: How get attachment ID Reply with quote

OK, if the only reason you want to know the attachment ID is so that
you can find it in the monitor, that's fine. My first reply shows you
how: Get the transaction ID and then derive the attachment ID from that:

SELECT
TMP$ATTACHMENT_ID
FROM
TMP$TRANSACTIONS
WHERE
TMP$TRANSACTION_ID = 1234;

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Useful articles about InterBase development:
http://blogs.teamb.com/craigstuntz/category/21.aspx
Back to top
maxi
Guest





PostPosted: Tue May 08, 2007 1:13 am    Post subject: Re: How get attachment ID Reply with quote

Bien, vamos de nuevo entonces... :)

El problema es el siguiente, el servidor datasnap es stateless no gaurda
información entra cada llamada. Se envia la información al servidor y si
es necesario vuelve al cliente donde se almacenará si correspondiese.
El servidor tiene modo de instanciación csMultiInstancing y
ThreadingModel tmApartment lo que hace que cada cliente genere una nueva
instancia y por lo tanto una nueva conexión cada que se conecta y además
la conexión a Interbase (TIBDatabase) usa siempre el mismo user_name.
Ahora lo que yo quiero lograr (si es posible) es al visualizar el monitor
de Interbase (tabla TMP$ATTACHMENT) saber a que cliente datasnap
corresponde dicha conexión, dado que siempre es la misma dirección IP (la
del servidor datasnap que es el verdadero cliente de Interbase).
Si llegase a haber una conexión "colgada" saber que cliente datasnap, que
terminal, lo provocó.


No sé si quedó más claro ahora.
Igualmente muchas gracias por tu tiempo.


Regards.



--- posted by geoForum on http://delphi.newswhat.com
Back to top
maxi
Guest





PostPosted: Tue May 08, 2007 6:34 am    Post subject: Re: How get attachment ID Reply with quote

Ok, I will try this.

One question more, how can get the transaction ID?
I use IBX 6.08 with Delphi 6.02 Enterprise, is possible with this version?





Craig Stuntz [TeamB] escribió:
Quote:
OK, if the only reason you want to know the attachment ID is so that
you can find it in the monitor, that's fine. My first reply shows you
how: Get the transaction ID and then derive the attachment ID from that:

SELECT
TMP$ATTACHMENT_ID
FROM
TMP$TRANSACTIONS
WHERE
TMP$TRANSACTION_ID = 1234;
Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Tue May 08, 2007 6:59 am    Post subject: Re: How get attachment ID Reply with quote

maxi wrote:
Quote:

One question more, how can get the transaction ID?
I use IBX 6.08 with Delphi 6.02 Enterprise, is possible with this
version?

Not possible with version 6.x of InterBase, TMP$ATTACHMENTS and other such
tables were only added in InterBase 7.0.

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"It is error alone which needs the support of government. Truth can
stand by itself." - Thomas Jefferson
Back to top
maxi
Guest





PostPosted: Tue May 08, 2007 4:41 pm    Post subject: Re: How get attachment ID Reply with quote

Sorry, may be I don't be clear.
I use IBX 6.08 version for Delphi 6.02 but against Interbase 7.5


Wayne Niddery [TeamB] escribió:
Quote:
maxi wrote:
One question more, how can get the transaction ID?
I use IBX 6.08 with Delphi 6.02 Enterprise, is possible with this
version?

Not possible with version 6.x of InterBase, TMP$ATTACHMENTS and other such
tables were only added in InterBase 7.0.
Back to top
Craig Stuntz [TeamB]
Guest





PostPosted: Tue May 08, 2007 5:34 pm    Post subject: Re: How get attachment ID Reply with quote

maxi wrote:

Quote:
One question more, how can get the transaction ID?

In the current version of IBX, it's TIBTransaction.TransactionID. I
don't remember if this property exists in 6.08 or not.

--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
IB 6 versions prior to 6.0.1.6 are pre-release and may corrupt
your DBs! Open Edition users, get 6.0.1.6 from http://mers.com
Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Tue May 08, 2007 7:10 pm    Post subject: Re: How get attachment ID Reply with quote

maxi wrote:
Quote:
Sorry, may be I don't be clear.
I use IBX 6.08 version for Delphi 6.02 but against Interbase 7.5

Sorry, I misread "6.02" and thought of IB 6.02 intead of Delpih.

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"In a tornado, even turkeys can fly." - unknown
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (InterBase Express) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.