This job will show SQL Servers, their databases and the usernames for each database. Obviously you will need appropriate trusted login rigths for the server to retrrive this information. The login names can also be retrieved from one of the DMO objects but obviously it's not possible to retrieve the passwords for the logins for security reasons.
Regards
Thomas
static void ListSQLServers(Args _args)
{
COM com = new COM("SQLDMO.Application");
COM servers = com.ListAvailableSQLServers();
COM sqlserver;
COM databases;
COM database;
COM users;
COM user;
int i;
int j;
int k;
;
setprefix("SQL Servers");
for (i=1;i<=servers.count();i++)
{
setprefix(servers.item(i));
try
{
sqlserver = new COM("SQLDMO.SQLServer");
sqlserver.loginsecure(true);
sqlserver.connect(servers.item(i));
databases = sqlserver.databases();
for (j=1;j<=databases.count();j++)
{
database = databases.item(j);
setprefix(database.name());
users = database.users();
for (k=1;k<=users.count();k++)
{
user = users.item(k);
info(user.name());
}
}
}
catch (Exception::Error)
{
info("Could not connect to server");
}
}
}
________________________________
Fra: Axapta-Knowledge-Village@yahoogroups.com på vegne af [EMAIL PROTECTED]
Sendt: ti 09-05-2006 12:31
Til: Axapta-Knowledge-Village@yahoogroups.com
Emne: Re: SV: [Axapta-Knowledge-Village] how do i get the database server names, database names
Hi Thomas,
Thank u. it is working fine. pls. kindly tell me how do i get the databases
names
under the selected server and also its corresponding userid and
password. urgent.
regs,
Hema. S
"Thomas Jensen"
<[EMAIL PROTECTED]> To:
<Axapta-Knowledge-Village@yahoogroups.com>
Sent by: cc:
[EMAIL PROTECTED] Subject: SV:
[Axapta-Knowledge-Village] how do i get the database
groups.com server names,
database names
05/09/2006 12:56 PM
Please respond to
Axapta-Knowledge-Village
Try this:
static void ListSQLServers(Args _args)
{
COM com = new COM("SQLDMO.Application");
COM servers = com.ListAvailableSQLServers();
int i;
;
for (i=1;i<=servers.count();i++)
info(servers.item(i));
}
regards
Thomas
________________________________
Fra: Axapta-Knowledge-Village@yahoogroups.com på vegne af
[EMAIL PROTECTED]
Sendt: ti 09-05-2006 09:07
Til: Axapta-Knowledge-Village@yahoogroups.com;
development-axapta@yahoogroups.com
Emne: [Axapta-Knowledge-Village] how do i get the database server names,
database names
Hi,
how do i get all the database server names from all the machines in an
organization?
ex:
-----
in aos settings, we can see the list of database servers against Server
combo. how do i get all those names thro' x++ coding? based on the
selection of server, i want to get the database names. again i want to get
the userid and password of the specified database name.
wherever sql server is installed in the machines, all the server names and
its corresponding database names, userid and password should be displayed
in the combo. how do i do?
pls. provide the solution. urgent.
regs,
Hema. S
Sharing the knowledge on Axapta.
Visit www.frappr.com/axapta for axapta friends.
Yahoo! Groups Links
[Non-text portions of this message have been removed]
Sharing the knowledge on Axapta.
Visit www.frappr.com/axapta for axapta friends.
SPONSORED LINKS
Business finance Business to Small business
course business finance finance
Business finance Business finance Business finance
consultant magazine schools
YAHOO! GROUPS LINKS
Visit your group "Axapta-Knowledge-Village" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Sharing the knowledge on Axapta.
Visit www.frappr.com/axapta for axapta friends.
SPONSORED LINKS
Business finance Business to Small business
course business finance finance
Business finance Business finance Business finance
consultant magazine schools
YAHOO! GROUPS LINKS
Visit your group "Axapta-Knowledge-Village" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Sharing the knowledge on Axapta.
Visit www.frappr.com/axapta for axapta friends.
Yahoo! Groups Links
[Non-text portions of this message have been removed]
Sharing the knowledge on Axapta.
Visit www.frappr.com/axapta for axapta friends.
SPONSORED LINKS
Business finance course | Business to business finance | Small business finance |
Business finance consultant | Business finance magazine | Business finance schools |
YAHOO! GROUPS LINKS
- Visit your group "Axapta-Knowledge-Village" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.