You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Ma...@de.equens.com on 2012/07/17 16:44:35 UTC

schema-questions

hi to all,
I am using derby (10.8)  with tomcat and used following side helping me
seitting them up: http://www.zetcode.com/db/apachederbytutorial/tomcat/ 
Trying to build up a simple web-application where you could register as
user etc. I have following schema
CREATE SCHEMA USER_STUFF;
CREATE TABLE USERS(  name           VARCHAR(100) PRIMARY KEY
                   , hatchi         VARCHAR(40)
                   , email          VARCHAR(100)
                   , imagename      VARCHAR(100)
                   , tstmp_in       TIMESTAMP NOT NULL DEFAULT
CURRENT_TIMESTAMP
                   , tstmp_up       TIMESTAMP 
                  );
now I am wondering that when I connect myself as a user the name of the
schema's name is equal to the user's name.
If I don't use any user my schema's name seems to be the default schema
name "APP".
I thought using the first line of my sql script produces a schema named
USER_STUFF.
What is happening here, what am I doing wrong?
 
Another thing I am wondreing is, that it seems not to matter using a
user or not using following derby.properties, though:
derby.stream.error.logSeverityLevel=0
derby.database.fullAccessUsers=tech
derby.database.defaultConnectionMode=readOnlyAccess
derby.connection.requireAuthentication=true
derby.user.tech=lala_dongs
derby.user.rou=gaga_bings
 
derby.authentication.provider=builtin
 
 
derby seems not to use my derby.proerties. I have put them to the
directory, which is given in the derby.system.home Java-system-property.
It is told to put this system-property into the environment variable
JAVA_OPTS, so tomcat would use it for starting up.
I am using  Windows-XP so I defined ths environment-variable in the
dialog as user defined variable.
What am I missing, since derby.properties seem not to work may be not
even been read.
 
Thanks for hints in advance
 
Malte


Re: AW: schema-questions

Posted by Rick Hillegas <ri...@oracle.com>.
On 7/17/12 9:15 AM, Malte.Kempff@de.equens.com wrote:
>
> Hi Rick,
> Thanks a lot for you fast answer.
>
> Right now I am just trying to practice some web-application programming, so it does not matter much to me using BUILTIN, even though it has no productive quality. But thanks for the hint with NATIVE.
> Using the configuration right now lets use Tomcat the right db-directory, so I am afraid, that it not quite clear a tomcat issue.
> Did I understand the documentation of derby correctly that java-system-property 'derby.system.home' points to the directory derby.properties would be used from?
Hi Malte,

Yes, that is correct.
>   If I got that right than something must have happened to that property, even though derby uses the correct directory for ist db-instances. Is there a way to show up the properties the derby-engine is using or getting?
There is no easy way to get this information right now. I think that it 
is reasonable that the DBO would want to view this information and I 
have logged https://issues.apache.org/jira/browse/DERBY-5861 to track 
this enhancement. In the meantime, I have attached a table function to 
that issue along with instructions on how to use it. You should be able 
to use that table function to print out the derby properties that are 
visible from a database. The table function will not print out the 
BUILTIN credentials but it will print out the values of properties like 
derby.authentication.provider.

Hope this helps,
-Rick
>
> -----Ursprüngliche Nachricht-----
> Von: Rick Hillegas [mailto:rick.hillegas@oracle.com]
> Gesendet: Dienstag, 17. Juli 2012 17:11
> An: derby-user@db.apache.org
> Betreff: Re: schema-questions
>
> Hi Malta,
>
> One general issue: I see that you are trying to use BUILTIN authentication. Note that BUILTIN authentication is not production-quality. It is appropriate only for testing/development purposes. In 10.9.1 we introduced NATIVE authentication, a production-quality replacement for BUILTIN. You are encouraged to upgrade to 10.9.1 and to use NATIVE authentication instead. Hopefully, you will find that NATIVE authentication is easier to administer than BUILTIN was.
>
> Some more comments inline...
>
> On 7/17/12 7:44 AM, Malte.Kempff@de.equens.com wrote:
>> hi to all,
>> I am using derby (10.8)  with tomcat and used following side helping
>> me seitting them up:
>> http://www.zetcode.com/db/apachederbytutorial/tomcat/
>> Trying to build up a simple web-application where you could register
>> as user etc. I have following schema *CREATE SCHEMA USER_STUFF;
>> CREATE TABLE USERS(  name           VARCHAR(100) PRIMARY KEY
>>                     , hatchi         VARCHAR(40)
>>                     , email          VARCHAR(100)
>>                     , imagename      VARCHAR(100)
>>                     , tstmp_in       TIMESTAMP NOT NULL DEFAULT
>> CURRENT_TIMESTAMP
>>                     , tstmp_up       TIMESTAMP
>>                    );*
>> now I am wondering that when I connect myself as a user the name of
>> the schema's name is equal to the user's name.
>> If I don't use any user my schema's name seems to be the default
>> schema name "APP".
>> I thought using the first line of my sql script produces a schema
>> named USER_STUFF.
>> What is happening here, what am I doing wrong?
> Yes, the first command creates a schema called USER_STUFF owned by the APP user. However, that command does not change your session to use the new USER_STUFF schema. To change your default schema, you need to use this command:
>
> set schema USER_STUFF;
>> Another thing I am wondreing is, that it seems not to matter using a
>> user or not using following derby.properties, though:
>> *derby.stream.error.logSeverityLevel=0
>> derby.database.fullAccessUsers=tech
>> derby.database.defaultConnectionMode=readOnlyAccess
>> derby.connection.requireAuthentication=true
>> derby.user.tech=lala_dongs
>> derby.user.rou=gaga_bings*
>> **
>> *derby.authentication.provider=builtin*
>> derby seems not to use my derby.proerties. I have put them to the
>> directory, which is given in the derby.system.home Java-system-property.
>> It is told to put this system-property into the environment variable
>> JAVA_OPTS, so tomcat would use it for starting up.
>> I am using  Windows-XP so I defined ths environment-variable in the
>> dialog as user defined variable.
>> What am I missing, since derby.properties seem not to work may be not
>> even been read.
> I'm afraid I don't have any theories here. Maybe someone who uses Tomcat on Windows can give some advice.
>
> Hope this helps,
> -Rick
>> Thanks for hints in advance
>> Malte
>>
>


AW: schema-questions

Posted by Ma...@de.equens.com.
 
Hi Rick,
Thanks a lot for you fast answer.

Right now I am just trying to practice some web-application programming, so it does not matter much to me using BUILTIN, even though it has no productive quality. But thanks for the hint with NATIVE.
Using the configuration right now lets use Tomcat the right db-directory, so I am afraid, that it not quite clear a tomcat issue.
Did I understand the documentation of derby correctly that java-system-property 'derby.system.home' points to the directory derby.properties would be used from? If I got that right than something must have happened to that property, even though derby uses the correct directory for ist db-instances. Is there a way to show up the properties the derby-engine is using or getting?


-----Ursprüngliche Nachricht-----
Von: Rick Hillegas [mailto:rick.hillegas@oracle.com] 
Gesendet: Dienstag, 17. Juli 2012 17:11
An: derby-user@db.apache.org
Betreff: Re: schema-questions

Hi Malta,

One general issue: I see that you are trying to use BUILTIN authentication. Note that BUILTIN authentication is not production-quality. It is appropriate only for testing/development purposes. In 10.9.1 we introduced NATIVE authentication, a production-quality replacement for BUILTIN. You are encouraged to upgrade to 10.9.1 and to use NATIVE authentication instead. Hopefully, you will find that NATIVE authentication is easier to administer than BUILTIN was.

Some more comments inline...

On 7/17/12 7:44 AM, Malte.Kempff@de.equens.com wrote:
> hi to all,
> I am using derby (10.8)  with tomcat and used following side helping 
> me seitting them up:
> http://www.zetcode.com/db/apachederbytutorial/tomcat/
> Trying to build up a simple web-application where you could register 
> as user etc. I have following schema *CREATE SCHEMA USER_STUFF;
> CREATE TABLE USERS(  name           VARCHAR(100) PRIMARY KEY
>                    , hatchi         VARCHAR(40)
>                    , email          VARCHAR(100)
>                    , imagename      VARCHAR(100)
>                    , tstmp_in       TIMESTAMP NOT NULL DEFAULT 
> CURRENT_TIMESTAMP
>                    , tstmp_up       TIMESTAMP
>                   );*
> now I am wondering that when I connect myself as a user the name of 
> the schema's name is equal to the user's name.
> If I don't use any user my schema's name seems to be the default 
> schema name "APP".
> I thought using the first line of my sql script produces a schema 
> named USER_STUFF.
> What is happening here, what am I doing wrong?
Yes, the first command creates a schema called USER_STUFF owned by the APP user. However, that command does not change your session to use the new USER_STUFF schema. To change your default schema, you need to use this command:

set schema USER_STUFF;
> Another thing I am wondreing is, that it seems not to matter using a 
> user or not using following derby.properties, though:
> *derby.stream.error.logSeverityLevel=0
> derby.database.fullAccessUsers=tech
> derby.database.defaultConnectionMode=readOnlyAccess
> derby.connection.requireAuthentication=true
> derby.user.tech=lala_dongs
> derby.user.rou=gaga_bings*
> **
> *derby.authentication.provider=builtin*
> derby seems not to use my derby.proerties. I have put them to the 
> directory, which is given in the derby.system.home Java-system-property.
> It is told to put this system-property into the environment variable 
> JAVA_OPTS, so tomcat would use it for starting up.
> I am using  Windows-XP so I defined ths environment-variable in the 
> dialog as user defined variable.
> What am I missing, since derby.properties seem not to work may be not 
> even been read.
I'm afraid I don't have any theories here. Maybe someone who uses Tomcat on Windows can give some advice.

Hope this helps,
-Rick
> Thanks for hints in advance
> Malte
>


Re: schema-questions

Posted by Rick Hillegas <ri...@oracle.com>.
Hi Malta,

One general issue: I see that you are trying to use BUILTIN 
authentication. Note that BUILTIN authentication is not 
production-quality. It is appropriate only for testing/development 
purposes. In 10.9.1 we introduced NATIVE authentication, a 
production-quality replacement for BUILTIN. You are encouraged to 
upgrade to 10.9.1 and to use NATIVE authentication instead. Hopefully, 
you will find that NATIVE authentication is easier to administer than 
BUILTIN was.

Some more comments inline...

On 7/17/12 7:44 AM, Malte.Kempff@de.equens.com wrote:
> hi to all,
> I am using derby (10.8)  with tomcat and used following side helping 
> me seitting them up: 
> http://www.zetcode.com/db/apachederbytutorial/tomcat/
> Trying to build up a simple web-application where you could register 
> as user etc. I have following schema
> *CREATE SCHEMA USER_STUFF;
> CREATE TABLE USERS(  name           VARCHAR(100) PRIMARY KEY
>                    , hatchi         VARCHAR(40)
>                    , email          VARCHAR(100)
>                    , imagename      VARCHAR(100)
>                    , tstmp_in       TIMESTAMP NOT NULL DEFAULT 
> CURRENT_TIMESTAMP
>                    , tstmp_up       TIMESTAMP
>                   );*
> now I am wondering that when I connect myself as a user the name of 
> the schema's name is equal to the user's name.
> If I don't use any user my schema's name seems to be the default 
> schema name "APP".
> I thought using the first line of my sql script produces a schema 
> named USER_STUFF.
> What is happening here, what am I doing wrong?
Yes, the first command creates a schema called USER_STUFF owned by the 
APP user. However, that command does not change your session to use the 
new USER_STUFF schema. To change your default schema, you need to use 
this command:

set schema USER_STUFF;
> Another thing I am wondreing is, that it seems not to matter using a 
> user or not using following derby.properties, though:
> *derby.stream.error.logSeverityLevel=0
> derby.database.fullAccessUsers=tech
> derby.database.defaultConnectionMode=readOnlyAccess
> derby.connection.requireAuthentication=true
> derby.user.tech=lala_dongs
> derby.user.rou=gaga_bings*
> **
> *derby.authentication.provider=builtin*
> derby seems not to use my derby.proerties. I have put them to the 
> directory, which is given in the derby.system.home Java-system-property.
> It is told to put this system-property into the environment variable 
> JAVA_OPTS, so tomcat would use it for starting up.
> I am using  Windows-XP so I defined ths environment-variable in the 
> dialog as user defined variable.
> What am I missing, since derby.properties seem not to work may be not 
> even been read.
I'm afraid I don't have any theories here. Maybe someone who uses Tomcat 
on Windows can give some advice.

Hope this helps,
-Rick
> Thanks for hints in advance
> Malte
>


AW: AW: AW: AW: schema-questions

Posted by Ma...@de.equens.com.
 
Hi Tim and Kristian,
Thanks to that hint, and it is korrect I focus on web-client technology, but I just was wondering and curious about those parameters.
I have set values on the log and trace parameter within the network client via the web-app of Derby and found resonable results :-)

-----Ursprüngliche Nachricht-----
Von: Kristian Waagan [mailto:kristian.waagan@oracle.com] 
Gesendet: Freitag, 20. Juli 2012 09:26
An: derby-user@db.apache.org
Betreff: Re: AW: AW: AW: schema-questions

On 19.07.2012 18:44, Tim Watts wrote:
> My impression is that your goal is to explore web app development 
> using Derby.  In general, focusing on performance tuning in the 
> absence of an actual performance issue is not going to be very productive.

The above sounds like a good piece of advice to me.

That said, in the case of using Derby from an application server (single server, one connection pool) I would restrict the number of concurrent connections by configuring the connection pool.
Without having tested the timeslice and max threads properties of the network server in depth, my impression is that you should not use them unless you really have to. One such scenario may be if you for some reason allow direct access to your network server and have no other mechanism to restrict the number of concurrent connections.

With regards to Tomcat deployment, do you know where the derby.log file ends up?
I've seen it end up in the logs-directory of the Tomcat installation.


Regards,
-- 
Kristian

Re: AW: AW: AW: schema-questions

Posted by Kristian Waagan <kr...@oracle.com>.
On 19.07.2012 18:44, Tim Watts wrote:
> My impression is that your goal is to explore web app development using
> Derby.  In general, focusing on performance tuning in the absence of an
> actual performance issue is not going to be very productive.

The above sounds like a good piece of advice to me.

That said, in the case of using Derby from an application server (single 
server, one connection pool) I would restrict the number of concurrent 
connections by configuring the connection pool.
Without having tested the timeslice and max threads properties of the 
network server in depth, my impression is that you should not use them 
unless you really have to. One such scenario may be if you for some 
reason allow direct access to your network server and have no other 
mechanism to restrict the number of concurrent connections.

With regards to Tomcat deployment, do you know where the derby.log file 
ends up?
I've seen it end up in the logs-directory of the Tomcat installation.


Regards,
-- 
Kristian

Re: AW: AW: schema-questions

Posted by Rick Hillegas <ri...@oracle.com>.
On 7/23/12 7:09 AM, Malte.Kempff@de.equens.com wrote:
> Hi Rick,
> I am not sure if wrapping datasource is really a good place, because as far I understand the datasource is produced by the ApplicationServer.
Hi Malte,

Once again, I am outside my depth. I thought that app servers typically 
let you use an xml descriptor file to configure the DataSource along 
with other database bindings. In this solution you would edit that xml 
descriptor file and replace the name of the Derby DataSource with the 
name of your wrapper DataSource. But, as I said, I'm waving my hands.
> The hint I got was producing an own authentication by implementing org.apache.derby.authentication.UserAuthenticator interface
> If I do that, how can I put this to derby. I guees, since derby.authentication.provider has explicit values, I need to register it somehow within derby programmaticly, is that right?
The link below does not give me enough detail to understand this 
solution. Off the top of my head, I don't understand how you can solve 
this problem by writing a custom authenticator. A custom authenticator 
is only used to evaluate credentials. It has no access to the session 
and therefore has no ability to change the current schema. Its simple 
api is described here: 
http://db.apache.org/derby/javadoc/publishedapi/jdbc4/org/apache/derby/authentication/UserAuthenticator.html

Hope this helps,
-Rick
> Malte
>
> -----Ursprüngliche Nachricht-----
> Von: Rick Hillegas [mailto:rick.hillegas@oracle.com]
> Gesendet: Montag, 23. Juli 2012 15:48
> An: derby-user@db.apache.org
> Betreff: Re: AW: schema-questions
>
> On 7/23/12 6:34 AM, Malte.Kempff@de.equens.com wrote:
>> Hi to all,
>> I tried to find something on the internet belongig to my question:
>> what is to do for connecting with a user to a different schema than
>> the username or APP.
>> Actually I found 2 hints
>>
>>    1.
>>        use SET CURRENT SCHEMA
>>    2.
>>        Make your own custom authentication
>>
>> Source of above hints is this site:
>> http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html
>> <http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html>   that is
>> from 2006 Well choice 1. is not really usable when a datasource is to
>> be defined, is it?
>> Choice 2.seems to be a bit overheaded. Is it so exotic to connect with
>> a user using a different schema so nobody know how to or an custom
>> implementation needs to be produced on ones own?
>> Or is there a way in the newest release of Derby?
> Hi Malte,
>
> There is nothing new in this area in the latest 10.9.1 release of Derby.
>
> You might be able to workaround this problem by writing your own thin DataSource which wraps the DataSource you are currently using. Your wrapping DataSource would issue a SET SCHEMA command before returning from its getConnection() methods.
>
> Hope this helps,
> -Rick
>> Thanks for hints in advance
>> Malte
>> *Von:* Malte.Kempff@de.equens.com [mailto:Malte.Kempff@de.equens.com]
>> *Gesendet:* Freitag, 20. Juli 2012 18:56
>> *An:* derby-user@db.apache.org
>> *Betreff:* schema-questions
>>
>>
>> Somehow I ask now myself, how I can connect to another schema than the
>> username.
>> Currently I have a user tech that is suppose to connect to the schema
>> user_stuff via DataSource I tried now this but obviously ist not
>> correct becides the password is still ignored also the schema seems
>> not to be declared like this Context.xml for defining the DataSource:
>>
>> <?xml version="1.0" encoding="UTF-8"?>  <Context>  <Resource
>> name="jdbc/testdb"
>>                auth="Container"
>>                type="javax.sql.DataSource"
>>                username="tech"
>>                password="schnaddel"
>> *schema="USER_STUFF"
>> *              driverClassName="org.apache.derby.jdbc.ClientDriver"
>>                url="jdbc:derby://localhost:1527/testdb"
>>                maxActive="10"
>>                maxIdle="4"/>
>> </Context>
>>
>> Does anybody know what is to be used to be on the right schema
>> 'USER_STUFF' ?
>>
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Tim Watts [mailto:tim@cliftonfarm.org]
>> Gesendet: Donnerstag, 19. Juli 2012 18:44
>> An: Derby Discussion
>> Betreff: Re: AW: AW: AW: schema-questions
>>
>> On Thu, 2012-07-19 at 17:23 +0200, Malte.Kempff@de.equens.com wrote:
>>> Do I get it right, that the threads defined in Network server of
>>> derby should correspond with amount of connections in defined data
>>> source for derby in the Application Server, where it is running in?
>>> Is there any best practice?
>>>
>> I suppose so but not necessarily.  Unless you have an uncontrollable
>> need to complicate life I would leave it at the default of 0 ("elastic
>> mode").  This way Derby will spawn a thread to service each connection
>> as it's made.  A non-zero value will make that the upper limit for
>> worker threads.  Not that Derby will refuse further connections once
>> the max is reached; only that the new connections will have to wait
>> for CPU time until one of the other threads is done or it's timeSlice
>> has expired. (But, of course, adding more threads doesn't magically
>> create more CPU capacity.  So I imagine a non-zero value would be
>> balanced against the number of available cores/CPUs?)  I'm writing
>> from a theoretical perspective here as I haven't actually messed with
>> any of this.
>>
>> My impression is that your goal is to explore web app development
>> using Derby.  In general, focusing on performance tuning in the
>> absence of an actual performance issue is not going to be very productive.
>>
>>
>>> Malte
>>>
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Tim Watts [mailto:tim@cliftonfarm.org]
>>> Gesendet: Mittwoch, 18. Juli 2012 17:48
>>> An: Derby Discussion
>>> Betreff: Re: AW: AW: schema-questions
>>>
>>> Hi Malte,
>>>
>>> On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
>>>> Hi Tim
>>>> My JAVA_OPS look like that, when I use set command:
>>>> JAVA_OPTS=-Dderby.system.home=c:\derby-dbs
>>> That looks reasonable.
>>>
>>>> I suppose that the JAVA_OPTS are recognized by derby in my
>>>> particular case. Otherweise I would not understand why derby
>>>> produces and writes and reads from the given directory.
>>>> It is a bit of unexplainable to me, since today it works with
>>>> following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar
>>>> %DERBY_HOME %/lib/derbyrun.jar ij
>>>> ij>  connect
>>>> 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;passwo
>>>> rd
>>>> =d
>>>> uddeldi';
>>>> Here I get the expected error now:
>>>> FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
>>>> Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
>>>>
>>>>
>>>> Yesterday it did not work neither via ij nor within tomcat. Always
>>>> it did not matter whether the right password or user was set or not.
>>> It would be very difficult to figure out exactly what actually
>> happened between yesterday and today from a few sketchy details.  It
>> probably doesn't matter much at this point.
>>>> Using tomcat I still get that ignoring of derby.properties,
>>> Did you try invoking test.jsp from my last post?  That would tell
>> you if the running instance of Tomcat had a JAVA_OPTS and
>> derby.system.home passed through to it.
>>>> at least the password I am using seems not to matter at all Here
>>>> my entry in context.xml for tomcat similar to the recommanded one
>>>> I found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
>>>> <?xml version="1.0" encoding="UTF-8"?>  <Context>  <Resource
>>>> name="jdbc/testdb"
>>>>                auth="Container"
>>>>                type="javax.sql.DataSource"
>>>>                username="tech"
>>>>                password="schnaddel"
>>>>                driverClassName="org.apache.derby.jdbc.ClientDriver"
>>>>                url="jdbc:derby://localhost:1527/testdb"
>>>>                maxActive="10"
>>>>                maxIdle="4"/>
>>>>
>>>> </Context>
>>>>
>>>> The right password is supposed to be something else , but it works
>>>> :-D
>>>> (?!)
>>>>
>>>> By the way (sorry for asking such a question of beginners :-)):
>>>> Using the web-app of derby (Derby Network Server) there is the
>>>> option to change max amount of threads and thread time slices.
>>>> What does that mean exactly? Could that interfere with the
>>>> definition of DataSource within context.xml, or is that something
>>>> totally different?
>>> See
>>> http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthe
>>> ne
>>> tworkserver.html
>>>
>>>>
>>> Lastly, let me point out that there is absolutely NO requirement to
>> run the Derby war in order to use Derby from a web application.  You
>> could just as easily run the Derby Network Server in a separate
>> process or use an embedded Derby engine.  Just wanted to point that
>> out so you and others aware of the possibilities.
>>>>
>>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Tim Watts [mailto:tim@cliftonfarm.org]
>>>> Gesendet: Dienstag, 17. Juli 2012 22:36
>>>> An: Derby Discussion
>>>> Betreff: Re: AW: schema-questions
>>>>
>>>> On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
>>>>> I start tomcat (version 6) with ist startup batch file only
>>>>>
>>>> OK.  What displays when you type  echo %JAVA_OPTS%  at the command
>>>> prompt?
>>>>
>>>> To verify whether it's being passed through to Tomcat try saving
>>>> the following to webapps/ROOT/test.jsp then pointing your browser
>>>> to http://localhost:8080/test.jsp .
>>>>
>>>> test.jsp:
>>>> ---------
>>>> <html>
>>>> <body>
>>>> derby.system.home=<%= System.getProperty("derby.system.home")
>>>> %><br>  JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br>  </body>
>>>> </html>
>>>>
>>>> I have verified on my system that derby.properties is recognized
>>>> when setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
>>>>
>>>>
>>>>> -----Ursprüngliche Nachricht-----
>>>>> Von: Tim Watts [mailto:tim@cliftonfarm.org]
>>>>> Gesendet: Dienstag, 17. Juli 2012 18:08
>>>>> An: Derby Discussion
>>>>> Betreff: Re: schema-questions
>>>>>
>>>>> On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
>>>>>> Another thing I am wondreing is, that it seems not to matter
>>>>>> using a user or not using following derby.properties, though:
>>>>>> derby.stream.error.logSeverityLevel=0
>>>>>> derby.database.fullAccessUsers=tech
>>>>>> derby.database.defaultConnectionMode=readOnlyAccess
>>>>>> derby.connection.requireAuthentication=true
>>>>>> derby.user.tech=lala_dongs
>>>>>> derby.user.rou=gaga_bings
>>>>>>
>>>>>> derby.authentication.provider=builtin
>>>>>>
>>>>>>
>>>>>> derby seems not to use my derby.proerties. I have put them to
>>>>>> the directory, which is given in the derby.system.home
>>>>>> Java-system-property.
>>>>>> It is told to put this system-property into the environment
>>>>>> variable JAVA_OPTS, so tomcat would use it for starting up.
>>>>>> I am using  Windows-XP so I defined ths environment-variable
>>>>>> in the dialog as user defined variable.
>>>>>> What am I missing, since derby.properties seem not to work may
>>>>>> be not even been read.
>>>>>>
>>>>> Are you running Tomcat as a service?  If so then see this:
>>>>>
>>>>>
>>>>> http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.ht
>>>>> ml
>>>>>
>>>>> (adjust according to the tomcat version you're using).
>>>>>
>>>>>> Thanks for hints in advance
>>>>>>
>>>>>> Malte
>>>>>>
>


AW: AW: schema-questions

Posted by Ma...@de.equens.com.
Hi Rick,
I am not sure if wrapping datasource is really a good place, because as far I understand the datasource is produced by the ApplicationServer.
The hint I got was producing an own authentication by implementing org.apache.derby.authentication.UserAuthenticator interface
If I do that, how can I put this to derby. I guees, since derby.authentication.provider has explicit values, I need to register it somehow within derby programmaticly, is that right?

Malte

-----Ursprüngliche Nachricht-----
Von: Rick Hillegas [mailto:rick.hillegas@oracle.com] 
Gesendet: Montag, 23. Juli 2012 15:48
An: derby-user@db.apache.org
Betreff: Re: AW: schema-questions

On 7/23/12 6:34 AM, Malte.Kempff@de.equens.com wrote:
> Hi to all,
> I tried to find something on the internet belongig to my question: 
> what is to do for connecting with a user to a different schema than 
> the username or APP.
> Actually I found 2 hints
>
>   1.
>       use SET CURRENT SCHEMA
>   2.
>       Make your own custom authentication
>
> Source of above hints is this site: 
> http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html
> <http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html>  that is 
> from 2006 Well choice 1. is not really usable when a datasource is to 
> be defined, is it?
> Choice 2.seems to be a bit overheaded. Is it so exotic to connect with 
> a user using a different schema so nobody know how to or an custom 
> implementation needs to be produced on ones own?
> Or is there a way in the newest release of Derby?
Hi Malte,

There is nothing new in this area in the latest 10.9.1 release of Derby.

You might be able to workaround this problem by writing your own thin DataSource which wraps the DataSource you are currently using. Your wrapping DataSource would issue a SET SCHEMA command before returning from its getConnection() methods.

Hope this helps,
-Rick
> Thanks for hints in advance
> Malte
> *Von:* Malte.Kempff@de.equens.com [mailto:Malte.Kempff@de.equens.com]
> *Gesendet:* Freitag, 20. Juli 2012 18:56
> *An:* derby-user@db.apache.org
> *Betreff:* schema-questions
>
>
> Somehow I ask now myself, how I can connect to another schema than the 
> username.
> Currently I have a user tech that is suppose to connect to the schema 
> user_stuff via DataSource I tried now this but obviously ist not 
> correct becides the password is still ignored also the schema seems 
> not to be declared like this Context.xml for defining the DataSource:
>
> <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource 
> name="jdbc/testdb"
>               auth="Container"
>               type="javax.sql.DataSource"
>               username="tech"
>               password="schnaddel"
> *schema="USER_STUFF"
> *              driverClassName="org.apache.derby.jdbc.ClientDriver"
>               url="jdbc:derby://localhost:1527/testdb"
>               maxActive="10"
>               maxIdle="4"/>
> </Context>
>
> Does anybody know what is to be used to be on the right schema 
> 'USER_STUFF' ?
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org]
> Gesendet: Donnerstag, 19. Juli 2012 18:44
> An: Derby Discussion
> Betreff: Re: AW: AW: AW: schema-questions
>
> On Thu, 2012-07-19 at 17:23 +0200, Malte.Kempff@de.equens.com wrote:
> > Do I get it right, that the threads defined in Network server of 
> > derby should correspond with amount of connections in defined data 
> > source for derby in the Application Server, where it is running in? 
> > Is there any best practice?
> >
> I suppose so but not necessarily.  Unless you have an uncontrollable 
> need to complicate life I would leave it at the default of 0 ("elastic 
> mode").  This way Derby will spawn a thread to service each connection 
> as it's made.  A non-zero value will make that the upper limit for 
> worker threads.  Not that Derby will refuse further connections once 
> the max is reached; only that the new connections will have to wait 
> for CPU time until one of the other threads is done or it's timeSlice 
> has expired. (But, of course, adding more threads doesn't magically 
> create more CPU capacity.  So I imagine a non-zero value would be 
> balanced against the number of available cores/CPUs?)  I'm writing 
> from a theoretical perspective here as I haven't actually messed with 
> any of this.
>
> My impression is that your goal is to explore web app development 
> using Derby.  In general, focusing on performance tuning in the 
> absence of an actual performance issue is not going to be very productive.
>
>
> > Malte
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Mittwoch, 18. Juli 2012 17:48
> > An: Derby Discussion
> > Betreff: Re: AW: AW: schema-questions
> >
> > Hi Malte,
> >
> > On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > Hi Tim
> > > My JAVA_OPS look like that, when I use set command:
> > > JAVA_OPTS=-Dderby.system.home=c:\derby-dbs
> >
> > That looks reasonable.
> >
> > >
> > > I suppose that the JAVA_OPTS are recognized by derby in my 
> > > particular case. Otherweise I would not understand why derby 
> > > produces and writes and reads from the given directory.
> > > It is a bit of unexplainable to me, since today it works with 
> > > following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar 
> > > %DERBY_HOME %/lib/derbyrun.jar ij
> > > ij> connect
> > > 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;passwo
> > > rd
> > > =d
> > > uddeldi';
> > > Here I get the expected error now:
> > > FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> > > Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> > >
> > >
> > > Yesterday it did not work neither via ij nor within tomcat. Always 
> > > it did not matter whether the right password or user was set or not.
> >
> > It would be very difficult to figure out exactly what actually
> happened between yesterday and today from a few sketchy details.  It 
> probably doesn't matter much at this point.
> >
> > >
> > > Using tomcat I still get that ignoring of derby.properties,
> >
> > Did you try invoking test.jsp from my last post?  That would tell
> you if the running instance of Tomcat had a JAVA_OPTS and 
> derby.system.home passed through to it.
> >
> > > at least the password I am using seems not to matter at all Here 
> > > my entry in context.xml for tomcat similar to the recommanded one 
> > > I found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> > > <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource 
> > > name="jdbc/testdb"
> > >               auth="Container"
> > >               type="javax.sql.DataSource"
> > >               username="tech"
> > >               password="schnaddel"
> > >               driverClassName="org.apache.derby.jdbc.ClientDriver"
> > >               url="jdbc:derby://localhost:1527/testdb"
> > >               maxActive="10"
> > >               maxIdle="4"/>
> > >
> > > </Context>
> > >
> > > The right password is supposed to be something else , but it works 
> > > :-D
> > > (?!)
> > >
> > > By the way (sorry for asking such a question of beginners :-)):
> > > Using the web-app of derby (Derby Network Server) there is the 
> > > option to change max amount of threads and thread time slices.
> > > What does that mean exactly? Could that interfere with the 
> > > definition of DataSource within context.xml, or is that something 
> > > totally different?
> >
> > See
> > http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthe
> > ne
> > tworkserver.html
> >
> > >
> > >
> > Lastly, let me point out that there is absolutely NO requirement to
> run the Derby war in order to use Derby from a web application.  You 
> could just as easily run the Derby Network Server in a separate 
> process or use an embedded Derby engine.  Just wanted to point that 
> out so you and others aware of the possibilities.
> >
> > >
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > Gesendet: Dienstag, 17. Juli 2012 22:36
> > > An: Derby Discussion
> > > Betreff: Re: AW: schema-questions
> > >
> > > On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > > > I start tomcat (version 6) with ist startup batch file only
> > > >
> > > OK.  What displays when you type  echo %JAVA_OPTS%  at the command 
> > > prompt?
> > >
> > > To verify whether it's being passed through to Tomcat try saving 
> > > the following to webapps/ROOT/test.jsp then pointing your browser 
> > > to http://localhost:8080/test.jsp .
> > >
> > > test.jsp:
> > > ---------
> > > <html>
> > > <body>
> > > derby.system.home=<%= System.getProperty("derby.system.home") 
> > > %><br> JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> 
> > > </html>
> > >
> > > I have verified on my system that derby.properties is recognized 
> > > when setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> > >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > > Gesendet: Dienstag, 17. Juli 2012 18:08
> > > > An: Derby Discussion
> > > > Betreff: Re: schema-questions
> > > >
> > > > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > > > Another thing I am wondreing is, that it seems not to matter 
> > > > > using a user or not using following derby.properties, though:
> > > > > derby.stream.error.logSeverityLevel=0
> > > > > derby.database.fullAccessUsers=tech
> > > > > derby.database.defaultConnectionMode=readOnlyAccess
> > > > > derby.connection.requireAuthentication=true
> > > > > derby.user.tech=lala_dongs
> > > > > derby.user.rou=gaga_bings
> > > > >
> > > > > derby.authentication.provider=builtin
> > > > >
> > > > >
> > > > > derby seems not to use my derby.proerties. I have put them to 
> > > > > the directory, which is given in the derby.system.home 
> > > > > Java-system-property.
> > > > > It is told to put this system-property into the environment 
> > > > > variable JAVA_OPTS, so tomcat would use it for starting up.
> > > > > I am using  Windows-XP so I defined ths environment-variable 
> > > > > in the dialog as user defined variable.
> > > > > What am I missing, since derby.properties seem not to work may 
> > > > > be not even been read.
> > > > >
> > > > Are you running Tomcat as a service?  If so then see this:
> > > >
> > > >
> > > > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.ht
> > > > ml
> > > >
> > > > (adjust according to the tomcat version you're using).
> > > >
> > > > > Thanks for hints in advance
> > > > >
> > > > > Malte
> > > > >
> > > >
> > >
> >
>


Re: AW: schema-questions

Posted by Rick Hillegas <ri...@oracle.com>.
On 7/23/12 6:34 AM, Malte.Kempff@de.equens.com wrote:
> Hi to all,
> I tried to find something on the internet belongig to my question: 
> what is to do for connecting with a user to a different schema than 
> the username or APP.
> Actually I found 2 hints
>
>   1.
>       use SET CURRENT SCHEMA
>   2.
>       Make your own custom authentication
>
> Source of above hints is this site: 
> http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html 
> <http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html>  that is 
> from 2006
> Well choice 1. is not really usable when a datasource is to be 
> defined, is it?
> Choice 2.seems to be a bit overheaded. Is it so exotic to connect with 
> a user using a different schema so nobody know how to or an custom 
> implementation needs to be produced on ones own?
> Or is there a way in the newest release of Derby?
Hi Malte,

There is nothing new in this area in the latest 10.9.1 release of Derby.

You might be able to workaround this problem by writing your own thin 
DataSource which wraps the DataSource you are currently using. Your 
wrapping DataSource would issue a SET SCHEMA command before returning 
from its getConnection() methods.

Hope this helps,
-Rick
> Thanks for hints in advance
> Malte
> *Von:* Malte.Kempff@de.equens.com [mailto:Malte.Kempff@de.equens.com]
> *Gesendet:* Freitag, 20. Juli 2012 18:56
> *An:* derby-user@db.apache.org
> *Betreff:* schema-questions
>
>
> Somehow I ask now myself, how I can connect to another schema than the 
> username.
> Currently I have a user tech that is suppose to connect to the schema 
> user_stuff via DataSource
> I tried now this but obviously ist not correct becides the password is 
> still ignored also the schema seems not to be declared like this
> Context.xml for defining the DataSource:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Context>
> <Resource name="jdbc/testdb"
>               auth="Container"
>               type="javax.sql.DataSource"
>               username="tech"
>               password="schnaddel"
> *schema="USER_STUFF"
> *              driverClassName="org.apache.derby.jdbc.ClientDriver"
>               url="jdbc:derby://localhost:1527/testdb"
>               maxActive="10"
>               maxIdle="4"/>
> </Context>
>
> Does anybody know what is to be used to be on the right schema 
> 'USER_STUFF' ?
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org]
> Gesendet: Donnerstag, 19. Juli 2012 18:44
> An: Derby Discussion
> Betreff: Re: AW: AW: AW: schema-questions
>
> On Thu, 2012-07-19 at 17:23 +0200, Malte.Kempff@de.equens.com wrote:
> > Do I get it right, that the threads defined in Network server of derby
> > should correspond with amount of connections in defined data source
> > for derby in the Application Server, where it is running in? Is there
> > any best practice?
> >
> I suppose so but not necessarily.  Unless you have an uncontrollable 
> need to complicate life I would leave it at the default of 0 ("elastic 
> mode").  This way Derby will spawn a thread to service each connection 
> as it's made.  A non-zero value will make that the upper limit for 
> worker threads.  Not that Derby will refuse further connections once 
> the max is reached; only that the new connections will have to wait 
> for CPU time until one of the other threads is done or it's timeSlice 
> has expired. (But, of course, adding more threads doesn't magically 
> create more CPU capacity.  So I imagine a non-zero value would be 
> balanced against the number of available cores/CPUs?)  I'm writing 
> from a theoretical perspective here as I haven't actually messed with 
> any of this.
>
> My impression is that your goal is to explore web app development 
> using Derby.  In general, focusing on performance tuning in the 
> absence of an actual performance issue is not going to be very productive.
>
>
> > Malte
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Mittwoch, 18. Juli 2012 17:48
> > An: Derby Discussion
> > Betreff: Re: AW: AW: schema-questions
> >
> > Hi Malte,
> >
> > On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > Hi Tim
> > > My JAVA_OPS look like that, when I use set command:
> > > JAVA_OPTS=-Dderby.system.home=c:\derby-dbs
> >
> > That looks reasonable.
> >
> > >
> > > I suppose that the JAVA_OPTS are recognized by derby in my
> > > particular case. Otherweise I would not understand why derby
> > > produces and writes and reads from the given directory.
> > > It is a bit of unexplainable to me, since today it works with
> > > following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar
> > > %DERBY_HOME %/lib/derbyrun.jar ij
> > > ij> connect
> > > 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password
> > > =d
> > > uddeldi';
> > > Here I get the expected error now:
> > > FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> > > Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> > >
> > >
> > > Yesterday it did not work neither via ij nor within tomcat. Always
> > > it did not matter whether the right password or user was set or not.
> >
> > It would be very difficult to figure out exactly what actually 
> happened between yesterday and today from a few sketchy details.  It 
> probably doesn't matter much at this point.
> >
> > >
> > > Using tomcat I still get that ignoring of derby.properties,
> >
> > Did you try invoking test.jsp from my last post?  That would tell 
> you if the running instance of Tomcat had a JAVA_OPTS and 
> derby.system.home passed through to it.
> >
> > > at least the password I am using seems not to matter at all Here my
> > > entry in context.xml for tomcat similar to the recommanded one I
> > > found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> > > <?xml version="1.0" encoding="UTF-8"?> <Context>
> > > <Resource name="jdbc/testdb"
> > >               auth="Container"
> > >               type="javax.sql.DataSource"
> > >               username="tech"
> > >               password="schnaddel"
> > >               driverClassName="org.apache.derby.jdbc.ClientDriver"
> > >               url="jdbc:derby://localhost:1527/testdb"
> > >               maxActive="10"
> > >               maxIdle="4"/>
> > >
> > > </Context>
> > >
> > > The right password is supposed to be something else , but it works
> > > :-D
> > > (?!)
> > >
> > > By the way (sorry for asking such a question of beginners :-)):
> > > Using the web-app of derby (Derby Network Server) there is the
> > > option to change max amount of threads and thread time slices.
> > > What does that mean exactly? Could that interfere with the
> > > definition of DataSource within context.xml, or is that something
> > > totally different?
> >
> > See
> > http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthene
> > tworkserver.html
> >
> > >
> > >
> > Lastly, let me point out that there is absolutely NO requirement to 
> run the Derby war in order to use Derby from a web application.  You 
> could just as easily run the Derby Network Server in a separate 
> process or use an embedded Derby engine.  Just wanted to point that 
> out so you and others aware of the possibilities.
> >
> > >
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > Gesendet: Dienstag, 17. Juli 2012 22:36
> > > An: Derby Discussion
> > > Betreff: Re: AW: schema-questions
> > >
> > > On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > > > I start tomcat (version 6) with ist startup batch file only
> > > >
> > > OK.  What displays when you type  echo %JAVA_OPTS%  at the command
> > > prompt?
> > >
> > > To verify whether it's being passed through to Tomcat try saving the
> > > following to webapps/ROOT/test.jsp then pointing your browser to
> > > http://localhost:8080/test.jsp .
> > >
> > > test.jsp:
> > > ---------
> > > <html>
> > > <body>
> > > derby.system.home=<%= System.getProperty("derby.system.home") %><br>
> > > JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>
> > >
> > > I have verified on my system that derby.properties is recognized
> > > when setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> > >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > > Gesendet: Dienstag, 17. Juli 2012 18:08
> > > > An: Derby Discussion
> > > > Betreff: Re: schema-questions
> > > >
> > > > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > > > Another thing I am wondreing is, that it seems not to matter
> > > > > using a user or not using following derby.properties, though:
> > > > > derby.stream.error.logSeverityLevel=0
> > > > > derby.database.fullAccessUsers=tech
> > > > > derby.database.defaultConnectionMode=readOnlyAccess
> > > > > derby.connection.requireAuthentication=true
> > > > > derby.user.tech=lala_dongs
> > > > > derby.user.rou=gaga_bings
> > > > >
> > > > > derby.authentication.provider=builtin
> > > > >
> > > > >
> > > > > derby seems not to use my derby.proerties. I have put them to
> > > > > the directory, which is given in the derby.system.home
> > > > > Java-system-property.
> > > > > It is told to put this system-property into the environment
> > > > > variable JAVA_OPTS, so tomcat would use it for starting up.
> > > > > I am using  Windows-XP so I defined ths environment-variable in
> > > > > the dialog as user defined variable.
> > > > > What am I missing, since derby.properties seem not to work may
> > > > > be not even been read.
> > > > >
> > > > Are you running Tomcat as a service?  If so then see this:
> > > >
> > > >
> > > > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> > > >
> > > > (adjust according to the tomcat version you're using).
> > > >
> > > > > Thanks for hints in advance
> > > > >
> > > > > Malte
> > > > >
> > > >
> > >
> >
>


AW: AW: schema-questions

Posted by Ma...@de.equens.com.
 
Hi José,

It might be a bit theoreticly thining of my own, but my motivation is here that the application code should not necessaryly know about the schema name, as well it does not know anything about user and password.

On the other hand, I researched a bit further what oracle got in this case:

http://stackoverflow.com/questions/2353594/default-schema-in-oracle-connection-url

supprisingly, there is a similar question from an oracle user and oracle seems to have anything here either :-D

Even though from a theoretical point of view, this request might be to exotic :-/

Well I put as set schema now in my applicational code.

Malte


________________________________

Von: José Ventura [mailto:st.never@gmail.com] 
Gesendet: Montag, 23. Juli 2012 16:45
An: Derby Discussion
Betreff: Re: AW: schema-questions


Out of curiosity, and maybe a little off-topic: is there a reason to use a separate schema, when you can use a separate database? 

For example, if I have two completely unrelated applications, I think I would create two databases, and one datasource for each:

<Resource name="jdbc/app1ds" url="jdbc:derby://localhost:1527/app1db" ..... />
<Resource name="jdbc/app2ds" url="jdbc:derby://localhost:1527/app2db" ..... />

On Oracle I may have one database with several schemas, hence the need to specify the one I want. On Derby, would there be a benefit to reuse the same database with multiple schemas?

Just asking off the top of my head, I haven't really tried the above...

- José

On Mon, Jul 23, 2012 at 11:32 AM, Kristian Waagan <kr...@oracle.com> wrote:


	On 23.07.2012 15:34, Malte.Kempff@de.equens.com wrote: 

		Actually I found 2 hints

		1.	
			use SET CURRENT SCHEMA
		2.	
			Make your own custom authentication


For completeness, one can also specify the schema explicitly in the queries of course. I don't know if there are scenarios where this approach won't work.


-- 
Kristian




Re: AW: schema-questions

Posted by José Ventura <st...@gmail.com>.
Out of curiosity, and maybe a little off-topic: is there a reason to use a
separate schema, when you can use a separate database?

For example, if I have two completely unrelated applications, I think I
would create two databases, and one datasource for each:

<Resource name="jdbc/app1ds" url="jdbc:derby://localhost:1527/app1db" .....
/>
<Resource name="jdbc/app2ds" url="jdbc:derby://localhost:1527/app2db" .....
/>

On Oracle I may have one database with several schemas, hence the need to
specify the one I want. On Derby, would there be a benefit to reuse the
same database with multiple schemas?

Just asking off the top of my head, I haven't really tried the above...

- José

On Mon, Jul 23, 2012 at 11:32 AM, Kristian Waagan <
kristian.waagan@oracle.com> wrote:

>  On 23.07.2012 15:34, Malte.Kempff@de.equens.com wrote:
>
> Actually I found 2 hints
>
>    1. use SET CURRENT SCHEMA
>     2. Make your own custom authentication
>
>
> For completeness, one can also specify the schema explicitly in the
> queries of course. I don't know if there are scenarios where this approach
> won't work.
>
>
> --
> Kristian
>

AW: AW: schema-questions

Posted by Ma...@de.equens.com.
Hi Kristian,
You mean th qualifier for the tables, right. like in my case 
select * from user_stuff.users
 
Malte
________________________________

Von: Kristian Waagan [mailto:kristian.waagan@oracle.com] 
Gesendet: Montag, 23. Juli 2012 16:32
An: derby-user@db.apache.org
Betreff: Re: AW: schema-questions


On 23.07.2012 15:34, Malte.Kempff@de.equens.com wrote: 

	Actually I found 2 hints

	1.	
		use SET CURRENT SCHEMA
	2.	
		Make your own custom authentication


For completeness, one can also specify the schema explicitly in the
queries of course. I don't know if there are scenarios where this
approach won't work.


-- 
Kristian


Re: AW: schema-questions

Posted by Kristian Waagan <kr...@oracle.com>.
On 23.07.2012 15:34, Malte.Kempff@de.equens.com wrote:
> Actually I found 2 hints
>
> 1.
>     use SET CURRENT SCHEMA
> 2.
>     Make your own custom authentication
>

For completeness, one can also specify the schema explicitly in the 
queries of course. I don't know if there are scenarios where this 
approach won't work.


-- 
Kristian

AW: schema-questions

Posted by Ma...@de.equens.com.
Hi to all,
I tried to find something on the internet belongig to my question: what is to do for connecting with a user to a different schema than the username or APP.
Actually I found 2 hints

1.	
	use SET CURRENT SCHEMA
2.	
	Make your own custom authentication

Source of above hints is this site: http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html <http://www.oreillynet.com/onjava/blog/2006/07/on_derby.html>  that is from 2006
 
Well choice 1. is not really usable when a datasource is to be defined, is it? 
Choice 2.seems to be a bit overheaded. Is it so exotic to connect with a user using a different schema so nobody know how to or an custom implementation needs to be produced on ones own?
Or is there a way in the newest release of Derby? 
 
Thanks for hints in advance
 
Malte
 
________________________________

Von: Malte.Kempff@de.equens.com [mailto:Malte.Kempff@de.equens.com] 
Gesendet: Freitag, 20. Juli 2012 18:56
An: derby-user@db.apache.org
Betreff: schema-questions



Somehow I ask now myself, how I can connect to another schema than the username.
Currently I have a user tech that is suppose to connect to the schema user_stuff via DataSource
I tried now this but obviously ist not correct becides the password is still ignored also the schema seems not to be declared like this
Context.xml for defining the DataSource:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource name="jdbc/testdb"
              auth="Container"
              type="javax.sql.DataSource"
              username="tech"
              password="schnaddel"
              schema="USER_STUFF"
              driverClassName="org.apache.derby.jdbc.ClientDriver"
              url="jdbc:derby://localhost:1527/testdb"
              maxActive="10"
              maxIdle="4"/>
</Context>


Does anybody know what is to be used to be on the right schema 'USER_STUFF' ?



-----Ursprüngliche Nachricht-----
Von: Tim Watts [mailto:tim@cliftonfarm.org]
Gesendet: Donnerstag, 19. Juli 2012 18:44
An: Derby Discussion
Betreff: Re: AW: AW: AW: schema-questions

On Thu, 2012-07-19 at 17:23 +0200, Malte.Kempff@de.equens.com wrote:
> Do I get it right, that the threads defined in Network server of derby
> should correspond with amount of connections in defined data source
> for derby in the Application Server, where it is running in? Is there
> any best practice?
>
I suppose so but not necessarily.  Unless you have an uncontrollable need to complicate life I would leave it at the default of 0 ("elastic mode").  This way Derby will spawn a thread to service each connection as it's made.  A non-zero value will make that the upper limit for worker threads.  Not that Derby will refuse further connections once the max is reached; only that the new connections will have to wait for CPU time until one of the other threads is done or it's timeSlice has expired. (But, of course, adding more threads doesn't magically create more CPU capacity.  So I imagine a non-zero value would be balanced against the number of available cores/CPUs?)  I'm writing from a theoretical perspective here as I haven't actually messed with any of this.

My impression is that your goal is to explore web app development using Derby.  In general, focusing on performance tuning in the absence of an actual performance issue is not going to be very productive.


> Malte
>
>
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org]
> Gesendet: Mittwoch, 18. Juli 2012 17:48
> An: Derby Discussion
> Betreff: Re: AW: AW: schema-questions
>
> Hi Malte,
>
> On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> > Hi Tim
> > My JAVA_OPS look like that, when I use set command:
> > JAVA_OPTS=-Dderby.system.home=c:\derby-dbs
>
> That looks reasonable.
>
> >
> > I suppose that the JAVA_OPTS are recognized by derby in my
> > particular case. Otherweise I would not understand why derby
> > produces and writes and reads from the given directory.
> > It is a bit of unexplainable to me, since today it works with
> > following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar
> > %DERBY_HOME %/lib/derbyrun.jar ij
> > ij> connect
> > 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password
> > =d
> > uddeldi';
> > Here I get the expected error now:
> > FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> > Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> >
> >
> > Yesterday it did not work neither via ij nor within tomcat. Always
> > it did not matter whether the right password or user was set or not.
>
> It would be very difficult to figure out exactly what actually happened between yesterday and today from a few sketchy details.  It probably doesn't matter much at this point.
>
> >
> > Using tomcat I still get that ignoring of derby.properties,
>
> Did you try invoking test.jsp from my last post?  That would tell you if the running instance of Tomcat had a JAVA_OPTS and derby.system.home passed through to it.
>
> > at least the password I am using seems not to matter at all Here my
> > entry in context.xml for tomcat similar to the recommanded one I
> > found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> > <?xml version="1.0" encoding="UTF-8"?> <Context>
> >     <Resource name="jdbc/testdb"
> >               auth="Container"
> >               type="javax.sql.DataSource"
> >               username="tech"
> >               password="schnaddel"
> >               driverClassName="org.apache.derby.jdbc.ClientDriver"
> >               url="jdbc:derby://localhost:1527/testdb"
> >               maxActive="10"
> >               maxIdle="4"/>
> >
> > </Context>
> >
> > The right password is supposed to be something else , but it works
> > :-D
> > (?!)
> >
> > By the way (sorry for asking such a question of beginners :-)):
> > Using the web-app of derby (Derby Network Server) there is the
> > option to change max amount of threads and thread time slices.
> > What does that mean exactly? Could that interfere with the
> > definition of DataSource within context.xml, or is that something
> > totally different?
>
> See
> http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthene
> tworkserver.html
>
> >
> >
> Lastly, let me point out that there is absolutely NO requirement to run the Derby war in order to use Derby from a web application.  You could just as easily run the Derby Network Server in a separate process or use an embedded Derby engine.  Just wanted to point that out so you and others aware of the possibilities.
>
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Dienstag, 17. Juli 2012 22:36
> > An: Derby Discussion
> > Betreff: Re: AW: schema-questions
> >
> > On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > > I start tomcat (version 6) with ist startup batch file only
> > >
> > OK.  What displays when you type  echo %JAVA_OPTS%  at the command
> > prompt?
> >
> > To verify whether it's being passed through to Tomcat try saving the
> > following to webapps/ROOT/test.jsp then pointing your browser to
> > http://localhost:8080/test.jsp .
> >
> > test.jsp:
> > ---------
> > <html>
> > <body>
> > derby.system.home=<%= System.getProperty("derby.system.home") %><br>
> > JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>
> >
> > I have verified on my system that derby.properties is recognized
> > when setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > Gesendet: Dienstag, 17. Juli 2012 18:08
> > > An: Derby Discussion
> > > Betreff: Re: schema-questions
> > >
> > > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > > Another thing I am wondreing is, that it seems not to matter
> > > > using a user or not using following derby.properties, though:
> > > > derby.stream.error.logSeverityLevel=0
> > > > derby.database.fullAccessUsers=tech
> > > > derby.database.defaultConnectionMode=readOnlyAccess
> > > > derby.connection.requireAuthentication=true
> > > > derby.user.tech=lala_dongs
> > > > derby.user.rou=gaga_bings
> > > > 
> > > > derby.authentication.provider=builtin
> > > > 
> > > > 
> > > > derby seems not to use my derby.proerties. I have put them to
> > > > the directory, which is given in the derby.system.home
> > > > Java-system-property.
> > > > It is told to put this system-property into the environment
> > > > variable JAVA_OPTS, so tomcat would use it for starting up.
> > > > I am using  Windows-XP so I defined ths environment-variable in
> > > > the dialog as user defined variable.
> > > > What am I missing, since derby.properties seem not to work may
> > > > be not even been read.
> > > > 
> > > Are you running Tomcat as a service?  If so then see this:
> > >
> > >        
> > > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> > >
> > > (adjust according to the tomcat version you're using).
> > >
> > > > Thanks for hints in advance
> > > > 
> > > > Malte
> > > >
> > >
> >
>




schema-questions

Posted by Ma...@de.equens.com.
Somehow I ask now myself, how I can connect to another schema than the username.
Currently I have a user tech that is suppose to connect to the schema user_stuff via DataSource
I tried now this but obviously ist not correct becides the password is still ignored also the schema seems not to be declared like this
Context.xml for defining the DataSource:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource name="jdbc/testdb"
              auth="Container"
              type="javax.sql.DataSource"
              username="tech"
              password="schnaddel"
              schema="USER_STUFF"
              driverClassName="org.apache.derby.jdbc.ClientDriver"
              url="jdbc:derby://localhost:1527/testdb"
              maxActive="10"
              maxIdle="4"/>
</Context>


Does anybody know what is to be used to be on the right schema 'USER_STUFF' ?



-----Ursprüngliche Nachricht-----
Von: Tim Watts [mailto:tim@cliftonfarm.org]
Gesendet: Donnerstag, 19. Juli 2012 18:44
An: Derby Discussion
Betreff: Re: AW: AW: AW: schema-questions

On Thu, 2012-07-19 at 17:23 +0200, Malte.Kempff@de.equens.com wrote:
> Do I get it right, that the threads defined in Network server of derby
> should correspond with amount of connections in defined data source
> for derby in the Application Server, where it is running in? Is there
> any best practice?
>
I suppose so but not necessarily.  Unless you have an uncontrollable need to complicate life I would leave it at the default of 0 ("elastic mode").  This way Derby will spawn a thread to service each connection as it's made.  A non-zero value will make that the upper limit for worker threads.  Not that Derby will refuse further connections once the max is reached; only that the new connections will have to wait for CPU time until one of the other threads is done or it's timeSlice has expired. (But, of course, adding more threads doesn't magically create more CPU capacity.  So I imagine a non-zero value would be balanced against the number of available cores/CPUs?)  I'm writing from a theoretical perspective here as I haven't actually messed with any of this.

My impression is that your goal is to explore web app development using Derby.  In general, focusing on performance tuning in the absence of an actual performance issue is not going to be very productive.


> Malte
>
>
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org]
> Gesendet: Mittwoch, 18. Juli 2012 17:48
> An: Derby Discussion
> Betreff: Re: AW: AW: schema-questions
>
> Hi Malte,
>
> On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> > Hi Tim
> > My JAVA_OPS look like that, when I use set command:
> > JAVA_OPTS=-Dderby.system.home=c:\derby-dbs
>
> That looks reasonable.
>
> >
> > I suppose that the JAVA_OPTS are recognized by derby in my
> > particular case. Otherweise I would not understand why derby
> > produces and writes and reads from the given directory.
> > It is a bit of unexplainable to me, since today it works with
> > following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar
> > %DERBY_HOME %/lib/derbyrun.jar ij
> > ij> connect
> > 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password
> > =d
> > uddeldi';
> > Here I get the expected error now:
> > FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> > Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> >
> >
> > Yesterday it did not work neither via ij nor within tomcat. Always
> > it did not matter whether the right password or user was set or not.
>
> It would be very difficult to figure out exactly what actually happened between yesterday and today from a few sketchy details.  It probably doesn't matter much at this point.
>
> >
> > Using tomcat I still get that ignoring of derby.properties,
>
> Did you try invoking test.jsp from my last post?  That would tell you if the running instance of Tomcat had a JAVA_OPTS and derby.system.home passed through to it.
>
> > at least the password I am using seems not to matter at all Here my
> > entry in context.xml for tomcat similar to the recommanded one I
> > found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> > <?xml version="1.0" encoding="UTF-8"?> <Context>
> >     <Resource name="jdbc/testdb"
> >               auth="Container"
> >               type="javax.sql.DataSource"
> >               username="tech"
> >               password="schnaddel"
> >               driverClassName="org.apache.derby.jdbc.ClientDriver"
> >               url="jdbc:derby://localhost:1527/testdb"
> >               maxActive="10"
> >               maxIdle="4"/>
> >
> > </Context>
> >
> > The right password is supposed to be something else , but it works
> > :-D
> > (?!)
> >
> > By the way (sorry for asking such a question of beginners :-)):
> > Using the web-app of derby (Derby Network Server) there is the
> > option to change max amount of threads and thread time slices.
> > What does that mean exactly? Could that interfere with the
> > definition of DataSource within context.xml, or is that something
> > totally different?
>
> See
> http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthene
> tworkserver.html
>
> >
> >
> Lastly, let me point out that there is absolutely NO requirement to run the Derby war in order to use Derby from a web application.  You could just as easily run the Derby Network Server in a separate process or use an embedded Derby engine.  Just wanted to point that out so you and others aware of the possibilities.
>
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Dienstag, 17. Juli 2012 22:36
> > An: Derby Discussion
> > Betreff: Re: AW: schema-questions
> >
> > On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > > I start tomcat (version 6) with ist startup batch file only
> > >
> > OK.  What displays when you type  echo %JAVA_OPTS%  at the command
> > prompt?
> >
> > To verify whether it's being passed through to Tomcat try saving the
> > following to webapps/ROOT/test.jsp then pointing your browser to
> > http://localhost:8080/test.jsp .
> >
> > test.jsp:
> > ---------
> > <html>
> > <body>
> > derby.system.home=<%= System.getProperty("derby.system.home") %><br>
> > JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>
> >
> > I have verified on my system that derby.properties is recognized
> > when setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > Gesendet: Dienstag, 17. Juli 2012 18:08
> > > An: Derby Discussion
> > > Betreff: Re: schema-questions
> > >
> > > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > > Another thing I am wondreing is, that it seems not to matter
> > > > using a user or not using following derby.properties, though:
> > > > derby.stream.error.logSeverityLevel=0
> > > > derby.database.fullAccessUsers=tech
> > > > derby.database.defaultConnectionMode=readOnlyAccess
> > > > derby.connection.requireAuthentication=true
> > > > derby.user.tech=lala_dongs
> > > > derby.user.rou=gaga_bings
> > > > 
> > > > derby.authentication.provider=builtin
> > > > 
> > > > 
> > > > derby seems not to use my derby.proerties. I have put them to
> > > > the directory, which is given in the derby.system.home
> > > > Java-system-property.
> > > > It is told to put this system-property into the environment
> > > > variable JAVA_OPTS, so tomcat would use it for starting up.
> > > > I am using  Windows-XP so I defined ths environment-variable in
> > > > the dialog as user defined variable.
> > > > What am I missing, since derby.properties seem not to work may
> > > > be not even been read.
> > > > 
> > > Are you running Tomcat as a service?  If so then see this:
> > >
> > >        
> > > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> > >
> > > (adjust according to the tomcat version you're using).
> > >
> > > > Thanks for hints in advance
> > > > 
> > > > Malte
> > > >
> > >
> >
>




Re: AW: AW: AW: schema-questions

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Thu, 2012-07-19 at 17:23 +0200, Malte.Kempff@de.equens.com wrote:
> Do I get it right, that the threads defined in Network server of derby
> should correspond with amount of connections in defined data source
> for derby in the Application Server, where it is running in? Is there
> any best practice?
> 
I suppose so but not necessarily.  Unless you have an uncontrollable
need to complicate life I would leave it at the default of 0 ("elastic
mode").  This way Derby will spawn a thread to service each connection
as it's made.  A non-zero value will make that the upper limit for
worker threads.  Not that Derby will refuse further connections once the
max is reached; only that the new connections will have to wait for CPU
time until one of the other threads is done or it's timeSlice has
expired. (But, of course, adding more threads doesn't magically create
more CPU capacity.  So I imagine a non-zero value would be balanced
against the number of available cores/CPUs?)  I'm writing from a
theoretical perspective here as I haven't actually messed with any of
this.

My impression is that your goal is to explore web app development using
Derby.  In general, focusing on performance tuning in the absence of an
actual performance issue is not going to be very productive.


> Malte
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org] 
> Gesendet: Mittwoch, 18. Juli 2012 17:48
> An: Derby Discussion
> Betreff: Re: AW: AW: schema-questions
> 
> Hi Malte,
> 
> On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> > Hi Tim
> > My JAVA_OPS look like that, when I use set command:
> > JAVA_OPTS=-Dderby.system.home=c:\derby-dbs
> 
> That looks reasonable.
> 
> > 
> > I suppose that the JAVA_OPTS are recognized by derby in my particular 
> > case. Otherweise I would not understand why derby produces and writes 
> > and reads from the given directory.
> > It is a bit of unexplainable to me, since today it works with 
> > following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar 
> > %DERBY_HOME %/lib/derbyrun.jar ij
> > ij> connect
> > 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password=d
> > uddeldi';
> > Here I get the expected error now:
> > FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> > Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> > 
> > 
> > Yesterday it did not work neither via ij nor within tomcat. Always it 
> > did not matter whether the right password or user was set or not.
> 
> It would be very difficult to figure out exactly what actually happened between yesterday and today from a few sketchy details.  It probably doesn't matter much at this point.
> 
> > 
> > Using tomcat I still get that ignoring of derby.properties,
> 
> Did you try invoking test.jsp from my last post?  That would tell you if the running instance of Tomcat had a JAVA_OPTS and derby.system.home passed through to it.
> 
> > at least the password I am using seems not to matter at all Here my 
> > entry in context.xml for tomcat similar to the recommanded one I found 
> > in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> > <?xml version="1.0" encoding="UTF-8"?> <Context>
> >     <Resource name="jdbc/testdb" 
> >               auth="Container"
> >               type="javax.sql.DataSource" 
> >               username="tech"
> >               password="schnaddel"
> >               driverClassName="org.apache.derby.jdbc.ClientDriver"
> >               url="jdbc:derby://localhost:1527/testdb"
> >               maxActive="10" 
> >               maxIdle="4"/>
> > 
> > </Context>
> > 
> > The right password is supposed to be something else , but it works :-D
> > (?!)
> > 
> > By the way (sorry for asking such a question of beginners :-)):
> > Using the web-app of derby (Derby Network Server) there is the option 
> > to change max amount of threads and thread time slices.
> > What does that mean exactly? Could that interfere with the definition 
> > of DataSource within context.xml, or is that something totally 
> > different?
> 
> See http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthenetworkserver.html
> 
> > 
> > 
> Lastly, let me point out that there is absolutely NO requirement to run the Derby war in order to use Derby from a web application.  You could just as easily run the Derby Network Server in a separate process or use an embedded Derby engine.  Just wanted to point that out so you and others aware of the possibilities.
> 
> > 
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Dienstag, 17. Juli 2012 22:36
> > An: Derby Discussion
> > Betreff: Re: AW: schema-questions
> > 
> > On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > > I start tomcat (version 6) with ist startup batch file only
> > > 
> > OK.  What displays when you type  echo %JAVA_OPTS%  at the command 
> > prompt?
> > 
> > To verify whether it's being passed through to Tomcat try saving the 
> > following to webapps/ROOT/test.jsp then pointing your browser to 
> > http://localhost:8080/test.jsp .
> > 
> > test.jsp:
> > ---------
> > <html>
> > <body>
> > derby.system.home=<%= System.getProperty("derby.system.home") %><br> 
> > JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>
> > 
> > I have verified on my system that derby.properties is recognized when 
> > setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> > 
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > > Gesendet: Dienstag, 17. Juli 2012 18:08
> > > An: Derby Discussion
> > > Betreff: Re: schema-questions
> > > 
> > > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > > Another thing I am wondreing is, that it seems not to matter using 
> > > > a user or not using following derby.properties, though:
> > > > derby.stream.error.logSeverityLevel=0
> > > > derby.database.fullAccessUsers=tech
> > > > derby.database.defaultConnectionMode=readOnlyAccess
> > > > derby.connection.requireAuthentication=true
> > > > derby.user.tech=lala_dongs
> > > > derby.user.rou=gaga_bings
> > > >  
> > > > derby.authentication.provider=builtin
> > > >  
> > > >  
> > > > derby seems not to use my derby.proerties. I have put them to the 
> > > > directory, which is given in the derby.system.home 
> > > > Java-system-property.
> > > > It is told to put this system-property into the environment 
> > > > variable JAVA_OPTS, so tomcat would use it for starting up.
> > > > I am using  Windows-XP so I defined ths environment-variable in 
> > > > the dialog as user defined variable.
> > > > What am I missing, since derby.properties seem not to work may be 
> > > > not even been read.
> > > >  
> > > Are you running Tomcat as a service?  If so then see this:
> > > 
> > >         
> > > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> > > 
> > > (adjust according to the tomcat version you're using).
> > > 
> > > > Thanks for hints in advance
> > > >  
> > > > Malte
> > > > 
> > > 
> > 
> 


AW: AW: AW: schema-questions

Posted by Ma...@de.equens.com.
 
Hi Tim
Thanks for the given hints...

> Did you try invoking test.jsp from my last post?  That would tell you if the running instance of 
> Tomcat had a JAVA_OPTS and derby.system.home passed through to it.
Yes I did something very similar, I copied the particular lines of your jsp, into my own. The results are shown in the hardcopy I put the the mail yesterday. And from my point of view it looks very reasonable, or can you see something strange there?
I guess I also will try out the The DB-prcedure as workaround Rick was sending, as soon I got the time.
 
> Lastly, let me point out that there is absolutely NO requirement to run the Derby war in order to use Derby from a web application.  
> You could just as easily run the Derby Network Server in a separate process or use an embedded Derby engine.  Just wanted to point 
> that out so you and others aware of the possibilities.

Do I get it right, that the threads defined in Network server of derby should correspond with amount of connections in defined data source for derby in the Application Server, where it is running in? Is there any best practice?

Malte


-----Ursprüngliche Nachricht-----
Von: Tim Watts [mailto:tim@cliftonfarm.org] 
Gesendet: Mittwoch, 18. Juli 2012 17:48
An: Derby Discussion
Betreff: Re: AW: AW: schema-questions

Hi Malte,

On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> Hi Tim
> My JAVA_OPS look like that, when I use set command:
> JAVA_OPTS=-Dderby.system.home=c:\derby-dbs

That looks reasonable.

> 
> I suppose that the JAVA_OPTS are recognized by derby in my particular 
> case. Otherweise I would not understand why derby produces and writes 
> and reads from the given directory.
> It is a bit of unexplainable to me, since today it works with 
> following ij call java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar 
> %DERBY_HOME %/lib/derbyrun.jar ij
> ij> connect
> 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password=d
> uddeldi';
> Here I get the expected error now:
> FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> 
> 
> Yesterday it did not work neither via ij nor within tomcat. Always it 
> did not matter whether the right password or user was set or not.

It would be very difficult to figure out exactly what actually happened between yesterday and today from a few sketchy details.  It probably doesn't matter much at this point.

> 
> Using tomcat I still get that ignoring of derby.properties,

Did you try invoking test.jsp from my last post?  That would tell you if the running instance of Tomcat had a JAVA_OPTS and derby.system.home passed through to it.

> at least the password I am using seems not to matter at all Here my 
> entry in context.xml for tomcat similar to the recommanded one I found 
> in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> <?xml version="1.0" encoding="UTF-8"?> <Context>
>     <Resource name="jdbc/testdb" 
>               auth="Container"
>               type="javax.sql.DataSource" 
>               username="tech"
>               password="schnaddel"
>               driverClassName="org.apache.derby.jdbc.ClientDriver"
>               url="jdbc:derby://localhost:1527/testdb"
>               maxActive="10" 
>               maxIdle="4"/>
> 
> </Context>
> 
> The right password is supposed to be something else , but it works :-D
> (?!)
> 
> By the way (sorry for asking such a question of beginners :-)):
> Using the web-app of derby (Derby Network Server) there is the option 
> to change max amount of threads and thread time slices.
> What does that mean exactly? Could that interfere with the definition 
> of DataSource within context.xml, or is that something totally 
> different?

See http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthenetworkserver.html

> 
> 
Lastly, let me point out that there is absolutely NO requirement to run the Derby war in order to use Derby from a web application.  You could just as easily run the Derby Network Server in a separate process or use an embedded Derby engine.  Just wanted to point that out so you and others aware of the possibilities.

> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org]
> Gesendet: Dienstag, 17. Juli 2012 22:36
> An: Derby Discussion
> Betreff: Re: AW: schema-questions
> 
> On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > I start tomcat (version 6) with ist startup batch file only
> > 
> OK.  What displays when you type  echo %JAVA_OPTS%  at the command 
> prompt?
> 
> To verify whether it's being passed through to Tomcat try saving the 
> following to webapps/ROOT/test.jsp then pointing your browser to 
> http://localhost:8080/test.jsp .
> 
> test.jsp:
> ---------
> <html>
> <body>
> derby.system.home=<%= System.getProperty("derby.system.home") %><br> 
> JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>
> 
> I have verified on my system that derby.properties is recognized when 
> setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Dienstag, 17. Juli 2012 18:08
> > An: Derby Discussion
> > Betreff: Re: schema-questions
> > 
> > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > Another thing I am wondreing is, that it seems not to matter using 
> > > a user or not using following derby.properties, though:
> > > derby.stream.error.logSeverityLevel=0
> > > derby.database.fullAccessUsers=tech
> > > derby.database.defaultConnectionMode=readOnlyAccess
> > > derby.connection.requireAuthentication=true
> > > derby.user.tech=lala_dongs
> > > derby.user.rou=gaga_bings
> > >  
> > > derby.authentication.provider=builtin
> > >  
> > >  
> > > derby seems not to use my derby.proerties. I have put them to the 
> > > directory, which is given in the derby.system.home 
> > > Java-system-property.
> > > It is told to put this system-property into the environment 
> > > variable JAVA_OPTS, so tomcat would use it for starting up.
> > > I am using  Windows-XP so I defined ths environment-variable in 
> > > the dialog as user defined variable.
> > > What am I missing, since derby.properties seem not to work may be 
> > > not even been read.
> > >  
> > Are you running Tomcat as a service?  If so then see this:
> > 
> >         
> > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> > 
> > (adjust according to the tomcat version you're using).
> > 
> > > Thanks for hints in advance
> > >  
> > > Malte
> > > 
> > 
> 


Re: AW: AW: schema-questions

Posted by Tim Watts <ti...@cliftonfarm.org>.
Hi Malte,

On Wed, 2012-07-18 at 13:44 +0200, Malte.Kempff@de.equens.com wrote:
> Hi Tim
> My JAVA_OPS look like that, when I use set command:
> JAVA_OPTS=-Dderby.system.home=c:\derby-dbs

That looks reasonable.

> 
> I suppose that the JAVA_OPTS are recognized by derby in my particular
> case. Otherweise I would not understand why derby produces and writes
> and reads from the given directory.
> It is a bit of unexplainable to me, since today it works with
> following ij call
> java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar %DERBY_HOME
> %/lib/derbyrun.jar ij
> ij> connect
> 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password=duddeldi';
> Here I get the expected error now:
> FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden.
> Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.
> 
> 
> Yesterday it did not work neither via ij nor within tomcat. Always it
> did not matter whether the right password or user was set or not.

It would be very difficult to figure out exactly what actually happened
between yesterday and today from a few sketchy details.  It probably
doesn't matter much at this point.

> 
> Using tomcat I still get that ignoring of derby.properties, 

Did you try invoking test.jsp from my last post?  That would tell you if
the running instance of Tomcat had a JAVA_OPTS and derby.system.home
passed through to it.

> at least the password I am using seems not to matter at all
> Here my entry in context.xml for tomcat similar to the recommanded one
> I found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
> <?xml version="1.0" encoding="UTF-8"?>
> <Context>
>     <Resource name="jdbc/testdb" 
>               auth="Container"
>               type="javax.sql.DataSource" 
>               username="tech"
>               password="schnaddel"
>               driverClassName="org.apache.derby.jdbc.ClientDriver"
>               url="jdbc:derby://localhost:1527/testdb"
>               maxActive="10" 
>               maxIdle="4"/>
> 
> </Context>
> 
> The right password is supposed to be something else , but it works :-D
> (?!)
> 
> By the way (sorry for asking such a question of beginners :-)):
> Using the web-app of derby (Derby Network Server) there is the option
> to change max amount of threads and thread time slices.
> What does that mean exactly? Could that interfere with the definition
> of DataSource within context.xml, or is that something totally
> different?

See http://db.apache.org/derby/docs/10.8/adminguide/tadminconfiguringthenetworkserver.html

> 
> 
Lastly, let me point out that there is absolutely NO requirement to run
the Derby war in order to use Derby from a web application.  You could
just as easily run the Derby Network Server in a separate process or use
an embedded Derby engine.  Just wanted to point that out so you and
others aware of the possibilities.

> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org] 
> Gesendet: Dienstag, 17. Juli 2012 22:36
> An: Derby Discussion
> Betreff: Re: AW: schema-questions
> 
> On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> > I start tomcat (version 6) with ist startup batch file only
> > 
> OK.  What displays when you type  echo %JAVA_OPTS%  at the command
> prompt?
> 
> To verify whether it's being passed through to Tomcat try saving the
> following to webapps/ROOT/test.jsp then pointing your browser to
> http://localhost:8080/test.jsp .
> 
> test.jsp:
> ---------
> <html>
> <body>
> derby.system.home=<%= System.getProperty("derby.system.home") %><br>
> JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>
> 
> I have verified on my system that derby.properties is recognized when
> setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)
> 
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Tim Watts [mailto:tim@cliftonfarm.org]
> > Gesendet: Dienstag, 17. Juli 2012 18:08
> > An: Derby Discussion
> > Betreff: Re: schema-questions
> > 
> > On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > > Another thing I am wondreing is, that it seems not to matter using a 
> > > user or not using following derby.properties, though:
> > > derby.stream.error.logSeverityLevel=0
> > > derby.database.fullAccessUsers=tech
> > > derby.database.defaultConnectionMode=readOnlyAccess
> > > derby.connection.requireAuthentication=true
> > > derby.user.tech=lala_dongs
> > > derby.user.rou=gaga_bings
> > >  
> > > derby.authentication.provider=builtin
> > >  
> > >  
> > > derby seems not to use my derby.proerties. I have put them to the 
> > > directory, which is given in the derby.system.home 
> > > Java-system-property.
> > > It is told to put this system-property into the environment variable 
> > > JAVA_OPTS, so tomcat would use it for starting up.
> > > I am using  Windows-XP so I defined ths environment-variable in the 
> > > dialog as user defined variable.
> > > What am I missing, since derby.properties seem not to work may be 
> > > not even been read.
> > >  
> > Are you running Tomcat as a service?  If so then see this:
> > 
> >         
> > http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> > 
> > (adjust according to the tomcat version you're using).
> > 
> > > Thanks for hints in advance
> > >  
> > > Malte
> > > 
> > 
> 


AW: AW: schema-questions

Posted by Ma...@de.equens.com.
Hi Tim
My JAVA_OPS look like that, when I use set command:
JAVA_OPTS=-Dderby.system.home=c:\derby-dbs

I suppose that the JAVA_OPTS are recognized by derby in my particular case. Otherweise I would not understand why derby produces and writes and reads from the given directory.

It is a bit of unexplainable to me, since today it works with following ij call
java %JAVA_OPTS% -Dij.protocol=jebc:derby: -jar %DERBY_HOME%/lib/derbyrun.jar ij
ij> connect 'jdbc:derby://localhost:1527/testdb;create=true;user=tralla;password=duddeldi';
Here I get the expected error now:
FEHLER 08004: Die Verbindung konnte nicht authentifiziert werden. Ursache: Die Benutzer-ID oder das Kennwort ist ung³ltig.


Yesterday it did not work neither via ij nor within tomcat. Always it did not matter whether the right password or user was set or not.

Using tomcat I still get that ignoring of derby.properties, at least the password I am using seems not to matter at all
Here my entry in context.xml for tomcat similar to the recommanded one I found in http://www.zetcode.com/db/apachederbytutorial/tomcat/
<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Resource name="jdbc/testdb" 
              auth="Container"
              type="javax.sql.DataSource" 
              username="tech"
              password="schnaddel"
              driverClassName="org.apache.derby.jdbc.ClientDriver"
              url="jdbc:derby://localhost:1527/testdb"
              maxActive="10" 
              maxIdle="4"/>

</Context>

The right password is supposed to be something else , but it works :-D (?!)

By the way (sorry for asking such a question of beginners :-)):
Using the web-app of derby (Derby Network Server) there is the option to change max amount of threads and thread time slices.
What does that mean exactly? Could that interfere with the definition of DataSource within context.xml, or is that something totally different?





-----Ursprüngliche Nachricht-----
Von: Tim Watts [mailto:tim@cliftonfarm.org] 
Gesendet: Dienstag, 17. Juli 2012 22:36
An: Derby Discussion
Betreff: Re: AW: schema-questions

On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> I start tomcat (version 6) with ist startup batch file only
> 
OK.  What displays when you type  echo %JAVA_OPTS%  at the command prompt?

To verify whether it's being passed through to Tomcat try saving the following to webapps/ROOT/test.jsp then pointing your browser to http://localhost:8080/test.jsp .

test.jsp:
---------
<html>
<body>
derby.system.home=<%= System.getProperty("derby.system.home") %><br> JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br> </body> </html>

I have verified on my system that derby.properties is recognized when setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)


> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org]
> Gesendet: Dienstag, 17. Juli 2012 18:08
> An: Derby Discussion
> Betreff: Re: schema-questions
> 
> On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > Another thing I am wondreing is, that it seems not to matter using a 
> > user or not using following derby.properties, though:
> > derby.stream.error.logSeverityLevel=0
> > derby.database.fullAccessUsers=tech
> > derby.database.defaultConnectionMode=readOnlyAccess
> > derby.connection.requireAuthentication=true
> > derby.user.tech=lala_dongs
> > derby.user.rou=gaga_bings
> >  
> > derby.authentication.provider=builtin
> >  
> >  
> > derby seems not to use my derby.proerties. I have put them to the 
> > directory, which is given in the derby.system.home 
> > Java-system-property.
> > It is told to put this system-property into the environment variable 
> > JAVA_OPTS, so tomcat would use it for starting up.
> > I am using  Windows-XP so I defined ths environment-variable in the 
> > dialog as user defined variable.
> > What am I missing, since derby.properties seem not to work may be 
> > not even been read.
> >  
> Are you running Tomcat as a service?  If so then see this:
> 
>         
> http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> 
> (adjust according to the tomcat version you're using).
> 
> > Thanks for hints in advance
> >  
> > Malte
> > 
> 


Re: AW: schema-questions

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Tue, 2012-07-17 at 18:13 +0200, Malte.Kempff@de.equens.com wrote:
> I start tomcat (version 6) with ist startup batch file only
> 
OK.  What displays when you type  echo %JAVA_OPTS%  at the command
prompt?

To verify whether it's being passed through to Tomcat try saving the
following to webapps/ROOT/test.jsp then pointing your browser to
http://localhost:8080/test.jsp .

test.jsp:
---------
<html>
<body>
derby.system.home=<%= System.getProperty("derby.system.home") %><br>
JAVA_OPTS=<%= System.getenv("JAVA_OPTS") %><br>
</body>
</html>

I have verified on my system that derby.properties is recognized when
setting derby.system.home via JAVA_OPTS. (Derby 10.8.1.2)


> -----Ursprüngliche Nachricht-----
> Von: Tim Watts [mailto:tim@cliftonfarm.org] 
> Gesendet: Dienstag, 17. Juli 2012 18:08
> An: Derby Discussion
> Betreff: Re: schema-questions
> 
> On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> > Another thing I am wondreing is, that it seems not to matter using a 
> > user or not using following derby.properties, though:
> > derby.stream.error.logSeverityLevel=0
> > derby.database.fullAccessUsers=tech
> > derby.database.defaultConnectionMode=readOnlyAccess
> > derby.connection.requireAuthentication=true
> > derby.user.tech=lala_dongs
> > derby.user.rou=gaga_bings
> >  
> > derby.authentication.provider=builtin
> >  
> >  
> > derby seems not to use my derby.proerties. I have put them to the 
> > directory, which is given in the derby.system.home 
> > Java-system-property.
> > It is told to put this system-property into the environment variable 
> > JAVA_OPTS, so tomcat would use it for starting up.
> > I am using  Windows-XP so I defined ths environment-variable in the 
> > dialog as user defined variable.
> > What am I missing, since derby.properties seem not to work may be not 
> > even been read.
> >  
> Are you running Tomcat as a service?  If so then see this:
> 
>         http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html
> 
> (adjust according to the tomcat version you're using).
> 
> > Thanks for hints in advance
> >  
> > Malte
> > 
> 


AW: schema-questions

Posted by Ma...@de.equens.com.
 
I start tomcat (version 6) with ist startup batch file only

-----Ursprüngliche Nachricht-----
Von: Tim Watts [mailto:tim@cliftonfarm.org] 
Gesendet: Dienstag, 17. Juli 2012 18:08
An: Derby Discussion
Betreff: Re: schema-questions

On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> Another thing I am wondreing is, that it seems not to matter using a 
> user or not using following derby.properties, though:
> derby.stream.error.logSeverityLevel=0
> derby.database.fullAccessUsers=tech
> derby.database.defaultConnectionMode=readOnlyAccess
> derby.connection.requireAuthentication=true
> derby.user.tech=lala_dongs
> derby.user.rou=gaga_bings
>  
> derby.authentication.provider=builtin
>  
>  
> derby seems not to use my derby.proerties. I have put them to the 
> directory, which is given in the derby.system.home 
> Java-system-property.
> It is told to put this system-property into the environment variable 
> JAVA_OPTS, so tomcat would use it for starting up.
> I am using  Windows-XP so I defined ths environment-variable in the 
> dialog as user defined variable.
> What am I missing, since derby.properties seem not to work may be not 
> even been read.
>  
Are you running Tomcat as a service?  If so then see this:

        http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html

(adjust according to the tomcat version you're using).

> Thanks for hints in advance
>  
> Malte
> 


Re: schema-questions

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Tue, 2012-07-17 at 16:44 +0200, Malte.Kempff@de.equens.com wrote:
> Another thing I am wondreing is, that it seems not to matter using a
> user or not using following derby.properties, though:
> derby.stream.error.logSeverityLevel=0
> derby.database.fullAccessUsers=tech
> derby.database.defaultConnectionMode=readOnlyAccess
> derby.connection.requireAuthentication=true
> derby.user.tech=lala_dongs
> derby.user.rou=gaga_bings
>  
> derby.authentication.provider=builtin
>  
>  
> derby seems not to use my derby.proerties. I have put them to the
> directory, which is given in the derby.system.home
> Java-system-property.
> It is told to put this system-property into the environment variable
> JAVA_OPTS, so tomcat would use it for starting up.
> I am using  Windows-XP so I defined ths environment-variable in the
> dialog as user defined variable.
> What am I missing, since derby.properties seem not to work may be not
> even been read.
>  
Are you running Tomcat as a service?  If so then see this:

        http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html

(adjust according to the tomcat version you're using).

> Thanks for hints in advance
>  
> Malte
>