Skip to Content
avatar image
Former Member

Change Database without changing Transaction Object

Any ideas about change curent database without change (current) nor create a new transaction object.

I mean, exactly what I want is execute a simple ASE statement as:

use XXX ; where obviously XXX = database_name

Open table ....

Regards ...

Arnoldo Perozo

By the way I'm using ASE as target DBMS.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 29, 2015 at 03:30 PM

    Hi Arnoldo;

      When we need to do this in ASE, I use either ...

    1) A call to a Stored Procedure that can then cross DB boundaries.

      - OR -

    2) Proxy tables that map to different DB areas.

    HTH

    Regards .. Chris

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 29, 2015 at 06:51 PM

    There's always the DISCONNECT, change transaction object attributes, re-CONNECT, but that's not necessarily performance friendly.

    Depending on your DBMS and permissions, you may be able just to qualify your table names with the database (e.g. for ASE: ... from DBName..TableName ...).

    Good luck.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 29, 2015 at 07:17 PM

    same SERVER, but different database?  As you suggested Arnoldo, the use command will work.

    string ls_usedatabase

    ls_usedatabase = "USE ThatDatabase"

    execute immediate :ls_usedatabase using sqlca;

    just make sure that the login has permissions in the database you are changing to.

    note: this does not work in appeon

    also, i didn't try this in ASE, only sql server.  should still work

    Add comment
    10|10000 characters needed characters exceeded