Difference between revisions of "Documentation/DevGuide/Database/Creating a User"
From Apache OpenOffice Wiki
< Documentation | DevGuide
m (1 revision(s)) |
OOoWikiBot (talk | contribs) m (Robot: Changing Category:Database Access) |
||
| Line 28: | Line 28: | ||
{{PDL1}} | {{PDL1}} | ||
| − | [[Category: Database Access]] | + | |
| + | [[Category:Documentation/Developers Guide/Database Access]] | ||
Revision as of 11:41, 4 June 2008
The procedure to create a user is the same. The com.sun.star.sdbcx.XDataDescriptorFactory interface is used from the users container. Create a user with the UserDescriptor. The com.sun.star.sdbcx.UserDescriptor has an additional property than the User service supports. This additional property is the Password property which should be set. Then the UserDescriptor object can be appended to the user container.
// create a user
public static void createUser(XNameAccess xUsers) throws Exception,SQLException {
System.out.println("Example createUser");
XDataDescriptorFactory xUserFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(
XDataDescriptorFactory.class, xUsers);
if (xUserFac != null) {
// create the new table
XPropertySet xUser = xUserFac.createDataDescriptor();
// set the name of the new table
xUser.setPropertyValue("Name", "BOSS");
xUser.setPropertyValue("Password","BOSSWIFENAME");
XAppend xAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xUserFac);
xAppend.appendByDescriptor(xUser);
}
}
| Content on this page is licensed under the Public Documentation License (PDL). |