Difference between revisions of "Documentation/DevGuide/Database/Creating a User"
From Apache OpenOffice Wiki
< Documentation | DevGuide
OOoWikiBot (Talk | contribs) m (FINAL VERSION FOR L10N) |
|||
Line 11: | Line 11: | ||
The procedure to create a user is the same. The <idl>com.sun.star.sdbcx.XDataDescriptorFactory</idl> interface is used from the users container. Create a user with the <code>UserDescriptor</code>. The <idl>com.sun.star.sdbcx.UserDescriptor</idl> has an additional property than the <code>User</code> service supports. This additional property is the <code>Password</code> property which should be set. Then the <code>UserDescriptor</code> object can be appended to the user container. | The procedure to create a user is the same. The <idl>com.sun.star.sdbcx.XDataDescriptorFactory</idl> interface is used from the users container. Create a user with the <code>UserDescriptor</code>. The <idl>com.sun.star.sdbcx.UserDescriptor</idl> has an additional property than the <code>User</code> service supports. This additional property is the <code>Password</code> property which should be set. Then the <code>UserDescriptor</code> object can be appended to the user container. | ||
<!--[SOURCE:Database/sdbcx.java]--> | <!--[SOURCE:Database/sdbcx.java]--> | ||
− | + | <syntaxhighlight lang="java"> | |
// create a user | // create a user | ||
public static void createUser(XNameAccess xUsers) throws Exception,SQLException { | public static void createUser(XNameAccess xUsers) throws Exception,SQLException { | ||
Line 27: | Line 27: | ||
} | } | ||
} | } | ||
− | + | </syntaxhighlight> | |
{{PDL1}} | {{PDL1}} | ||
[[Category:Documentation/Developer's Guide/Database Access]] | [[Category:Documentation/Developer's Guide/Database Access]] |
Latest revision as of 15:13, 21 December 2020
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). |