Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 98983 invoked from network); 6 Jun 2008 13:20:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2008 13:20:34 -0000 Received: (qmail 33653 invoked by uid 500); 6 Jun 2008 13:20:36 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 33625 invoked by uid 500); 6 Jun 2008 13:20:36 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 33614 invoked by uid 99); 6 Jun 2008 13:20:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jun 2008 06:20:36 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.43.132] (HELO sca-es-mail-1.sun.com) (192.18.43.132) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jun 2008 13:19:44 +0000 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m56DK1HQ006658 for ; Fri, 6 Jun 2008 06:20:01 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0K2100L01M8V7J00@fe-sfbay-09.sun.com> (original mail from Richard.Hillegas@Sun.COM) for derby-user@db.apache.org; Fri, 06 Jun 2008 06:20:01 -0700 (PDT) Received: from richard-hillegas-computer.local ([129.150.17.75]) by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0K2100LOTMDDK7D0@fe-sfbay-09.sun.com> for derby-user@db.apache.org; Fri, 06 Jun 2008 06:20:01 -0700 (PDT) Date: Fri, 06 Jun 2008 06:20:00 -0700 From: Rick Hillegas Subject: Re: Database connection not bound to default database schema when authenticating through LDAP? In-reply-to: <4848E214.9010903@vivodinet.gr> Sender: Richard.Hillegas@Sun.COM To: Derby Discussion Message-id: <48493980.8070709@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 8BIT References: <484887F2.1020402@vivodinet.gr> <4848DD6A.7000200@sun.com> <4848E214.9010903@vivodinet.gr> User-Agent: Thunderbird 2.0.0.14 (Macintosh/20080421) X-Virus-Checked: Checked by ClamAV on apache.org Hi Andreas, I can see that for many applications it would be useful to have a concept of a database-wide default schema, that is, a schema that all users start out in when they get a fresh connection. That is not the way Derby works. For Derby, the default schema is user-specific, not database-wide. This is true even in the degenerate case of an embedded application which does not run with authentication turned on: in that case the username defaults to APP and the default schema is APP's schema. The 2003 SQL standard does not offer any guidance on this topic. According to part 2, section 4.37.2 (SQL-session identification), the default schema of a session is vendor-defined. I don't remember any deep reason about why Derby has this default behavior. It may be nothing more complicated than the fact that the original programmers were familiar with this default from previous databases which they had worked on. Some databases let you bind a default schema to a username. See for instance http://msdn.microsoft.com/en-us/library/ms190387.aspx. I think it would be straightforward to build such a mechanism for Derby--although this would take you into session startup logic and the devil could be in the details. I think there are plenty of people around who understand that logic and who could coach a newcomer through this project. In the meantime, the only workaround I see is for your application to force the schema to a default value when your application hands out connections. Please pardon me if I have talked past your real concern. Hope this helps, -Rick Andreas Kyrmegalos wrote: > Thanks �ystein, > I was just checking that now too, with builtin authentication. Same > result. My impression was that default schemas are attached to the > database not the connecting user. So, that since a user has been > authenticated and if there are no authorization locks in place there > wouldn't be a need to set the schema each time a user connects. > Something like a default behavior. But as you said the default > behavior is have the connecting username as the starting schema. > Thanks again. What I 'm trying to figure out is the rational behind > such an approach. If someone could shed some light on this? > > Andreas > > �ystein Gr�vlen wrote: >> >> The default schema is the same as the username, regardless of whether >> it exists or not. You can use 'set schema' to switch to another schema. >> >