01-30-2017 11:13 AM - edited 03-19-2019 12:03 PM
Hi,
I'm trying to query on mutliple db in Unity, but looks like 'run cuc dbquery' does not allow it.
admin:run cuc dbquery select map.description, u.alias from unitydirdb.tbl_mailboxmap map,unitymbxdb1.tbl_mailbox m,unitydirdb.tbl_globaluser u where m.mailboxobjectid=map.mailboxid and u.objectid=map.userobjectid and map.description != u.alias
The value of 'database_name' is not valid; see help or syntax for valid names
USAGE: run cuc dbquery database_name sql_statement [page]
Command failed
Does anybody know how to achieve this?
Nick
01-30-2017 11:03 PM
Hi Nick,
Please find the details below
database_name specifies the database that sql_statement operates on. Database names are case sensitive. Connection databases include:
–unitydirdb—contains the directory and configuration data
–unitydyndb—contains dynamic data used internally by Connection
–unitymbxdb1—contains the data about the current voice messages, including pointers to the audio files that are stored in the file system
–unityrptdb—contains audit log data
You could have a try using these names
Regards,
Anoop
01-31-2017 03:27 AM
Hi Anoop,
I'm well aware you need to provide a db name, but as my query joins tables from 2 databases, you can't just put one as database_name. Not working with 2 either.
with one db defined:
admin:run cuc dbquery unitydirdb select map.description, u.alias from unitydirdb.tbl_mailboxmap map,unitymbxdb1.tbl_mailbox m,unitydirdb.tbl_globaluser u where m.mailboxobjectid=map.mailboxid and u.objectid=map.userobjectid and map.description != u.alias
The specified table (unitydirdb.tbl_mailboxmap) is not in the database.
with 2 db defined:
admin:run cuc dbquery unitydirdb,unitymbxdb1 select map.description, u.alias from unitydirdb.tbl_mailboxmap map,unitymbxdb1.tbl_mailbox m,unitydirdb.tbl_globaluser u where m.mailboxobjectid=map.mailboxid and u.objectid=map.userobjectid and map.description != u.alias
The value of 'database_name' is not valid; see help or syntax for valid names
USAGE: run cuc dbquery database_name sql_statement [page]
Command failed
Nick
02-06-2017 02:13 AM
Finally got this working. Here's the correct syntax:
admin:run cuc dbquery unitydirdb select alias from unitydirdb:tbl_globaluser,unitymbxdb1:tbl_mailbox,unitydirdb:tbl_mailboxmap where mailboxobjectid=mailboxid and objectid=userobjectid and description != alias
Nick
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide