[ 
https://issues.apache.org/jira/browse/DERBY-5522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13232882#comment-13232882
 ] 

Kim Haase commented on DERBY-5522:
----------------------------------

Thanks so much, Rick. I would be very happy for you to redo the code examples 
to make them as simple as possible. I have always felt more comfortable using 
database properties rather than system properties because everything is done in 
the code and I don't have to worry about a properties file or command-line 
arguments. That explains why I never tried using NATIVE:$credsDB:LOCAL. I 
didn't really understand what it did.

I had an interesting experience just now trying to use ij to do what the code 
examples did.

When I use NATIVE authentication programmatically, I create the database, 
create the users, set the authentication provider to NATIVE::LOCAL, then shut 
down the database and reconnect to it. But in ij this doesn't seem to work.

Here I try connecting to the database as the owner, creating the user, then 
setting the authentication provider. I thought if I connected to the database 
with credentials when I created it, the credentials were supposed to be stored 
in the database, but they don't seem to be. 

ij> connect 'jdbc:derby:testDB;user=myself;password=mypass;create=true';
ij> select * from sys.sysusers;
USERNAME                                                                        
                                                |HASHINGSCHEME                  
                                                                                
                 |PASSWORD                                                      
                                                                  |LASTMODIFIED 
                
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

0 rows selected
ij> call SYSCS_UTIL.SYSCS_CREATE_USER('myself','mypass');
0 rows inserted/updated/deleted
ij> select * from sys.sysusers;
USERNAME                                                                        
                                                |HASHINGSCHEME                  
                                                                                
                 |PASSWORD                                                      
                                                                  |LASTMODIFIED 
                
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
myself                                                                          
                                                
|3b62:8b7e520587f398ddf91d7e51fdc027d8:1000:SHA-256                             
                                                 
|40b3e6fadf4d9c87d3e7ce206b4c41d1e76f174bf17dd8b185316b0a3240c2c1               
                                                 |2012-03-19 16:01:04.778      

1 row selected
ij> call 
syscs_util.syscs_set_database_property('derby.authentication.provider', 
'NATIVE::LOCAL' );
ERROR XCY05: Invalid change of the derby.authentication.provider property. This 
property cannot be set to NATIVE::LOCAL unless credentials for the database 
owner have been stored in the database using the SYSCS_UTIL.SYSCS_CREATE_USER 
procedure.

Well, I thought that's what I did. Also, it's interesting that after I create 
the user, I can see the password. I didn't think I was supposed to be able to 
do that. 

So if you use ij with NATIVE authentication, you have to start it with JVM args 
or a derby.properties file? 

In the meantime I will work on your comments.
                
> Document the NATIVE authentication scheme.
> ------------------------------------------
>
>                 Key: DERBY-5522
>                 URL: https://issues.apache.org/jira/browse/DERBY-5522
>             Project: Derby
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 10.9.0.0
>            Reporter: Rick Hillegas
>            Assignee: Kim Haase
>         Attachments: CreateNativeUsers.java, CreateNativeUsers.java, 
> DERBY-5522-devguide.diff, DERBY-5522-devguide.stat, DERBY-5522-devguide.zip, 
> NativeAuthExampleClient1.java, NativeAuthExampleClient2.java, 
> NativeAuthExampleEmbedded.java, NativeAuthExampleEmbedded.java, 
> NativeAuthExampleEmbedded.java, NativeAuthExampleEmbedded.java, 
> NativeAuthExampleEmbedded.java, NativeAuthExampleEmbedded.java, 
> UseNativeUsers.java, UseNativeUsers.java
>
>
> We should document NATIVE authentication after we have implemented the 
> changes described on DERBY-866. The documentation changes are described by 
> the functional spec UserManagement.html attached to that issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to