If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > how to retreive dbname in proc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-22-04, 11:16
supinformix supinformix is offline
Registered User
 
Join Date: Apr 2004
Location: Brussels
Posts: 57
how to retreive dbname in proc

In a stored procedure i want to know in which database the procedure is working ? how can we retreive this name ?
Why :
we're using same procedure in logged and non logged db.
in logged we've has to use transaction : begin-commit-rollback, in non logged we get error -256 when used;
If we know the database of the procedure we could retreive column is_logging from sysmaster:sysdatabases for that database and make a variable syntax in the SPL. like "if logging = 1 then begin work ; end if;"

someone can help ?
thanks
__________________
Yves & Willy
Reply With Quote
  #2 (permalink)  
Old 11-22-04, 12:44
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
Hi,

Perhaps this may help.

If you're using IDS, you can issue "onstat -u" & determine (by user) which thread(s) that user is executing. With this user information you can determine the sessid(s) of the thread(s).

Then issue "onstat -g sql <sessid>" and the current SQL being executed is displayed along with the current database name.
Reply With Quote
  #3 (permalink)  
Old 11-23-04, 03:06
nog nog is offline
Registered User
 
Join Date: Nov 2004
Posts: 26
I think this works;

select sdbs.* { is_logging }
from sysmaster:syssessions sess,
sysmaster:syslocks slocks,
sysmaster:sysdatabases sdbs
where sess.sid = DBINFO('sessionid')
and sess.sid = slocks.owner
and slocks.rowidlk = sdbs.rowid
and sdbs.name != "sysmaster"
Reply With Quote
  #4 (permalink)  
Old 11-23-04, 06:00
supinformix supinformix is offline
Registered User
 
Join Date: Apr 2004
Location: Brussels
Posts: 57
yes, that's it,

with "select sdbs.is_logging into is_logging .... "
it works fine.

Thanks
__________________
Yves & Willy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On