Web.cnf / can't change database
Posted in 1999
Topics: Installation, Setup & Upgrades
Is it possible to grab data from multiple databases with an AppPage? I have no idea how to do this. I am running Universal Server on Sun Solaris 2.5.1 using the web datablade module. I can set the apb up with one database just fine and access info from that database, but I cannot figure out how to grab info from another database as well. I have tried changing the following: <?MIVAR NAME=$MI_DATABASE>other_db<?/MIVAR> and <?MIVAR NAME=MI_DATABASE>other_db<?/MIVAR> and <?MIVAR NAME=!MI_DATABASE>other_db<?/MIVAR> and <?MISQL SQL="close database; database other_db; select * from table;"> Any suggestions other than installing the module to other_db and setting up a seperate webdriver? Thanks. Kevin M. Carroll GTE Wireless - Cincinnati
In article <36A7B0AC.49C6C413@seorf.ohiou.edu>,
"Kevin M. Carroll" <aa664@seorf.ohiou.edu> wrote:
> Is it possible to grab data from multiple databases with an AppPage? I
> have no idea how to do this. I am running Universal Server on Sun
> Solaris 2.5.1 using the web datablade module. I can set the apb up with
> one database just fine and access info from that database, but I cannot
> figure out how to grab info from another database as well. I have tried
> changing the following:
>
> <?MIVAR NAME=$MI_DATABASE>other_db<?/MIVAR>
> and
> <?MIVAR NAME=MI_DATABASE>other_db<?/MIVAR>
> and
> <?MIVAR NAME=!MI_DATABASE>other_db<?/MIVAR>
> and
> <?MISQL SQL="close database; database other_db; select * from table;">
>
> Any suggestions other than installing the module to other_db and setting
> up a seperate webdriver? Thanks.
>
> Kevin M. Carroll
> GTE Wireless - Cincinnati
1) you could do what you don't want to do and setup another webdriver.
But you still can't mix the results.
2) Something like:
<?MISQL SQL="SELECT c.id, d.id FROM DBNAME1@DBSERVER:webpages c,
DBNAME2@DBSERVER:webpages d where c.id = d.id order by
1,2;"><TR><TD>$1</TD><TD>$2</TD></TR><?/MISQL>
didn't work the first time I tried it, but now it seems to be working fine.
Of course you should be able to select from whatever tables you want.
(provided the user in the web.cnf has permissions for both DBs)
If you still have problems you could always write a stored procedure to
do the work. To do the above it would be something like:
----------------
CREATE FUNCTION TESTOTHER() RETURNS HTML;
DEFINE retval HTML;
DEFINE id1 VARCHAR(40);
DEFINE id2 VARCHAR(40);
LET retval="";
FOREACH SELECT c.id, d.id INTO id1, id2 FROM
DBNAME1@DBSERVER:webpages c, DBNAME2@DBSERVER:webpages d
where c.id = d.id
LET retval = retval || "<TR><TD>" || id1 || "</TD><TD>"
|| id2 || "</TD></TR>";
END FOREACH;
RETURN retval;
END FUNCTION;
---------------------
Then:
<?MISQL SQL="EXECUTE FUNCTION TESTOTHER();">$*<?/MISQL>
Would use/execute it.
It's actually better to do complicated stuff in a UDR anyway (not that what
you want to do is that complicated). The funtion can only return 1 row, so
you can just return HTML (and do all the formatting in the function) :-)
Again, the user in the web.cnf file still has to have permission ion both DBs.
Enjoy,
Tony
--
asalerno@monmouth.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own