db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wolfgang12...@yahoo.co.jp
Subject Re: user authentication
Date Thu, 29 Sep 2005 15:34:49 GMT
Hi Nicolas

Don't worry many people are stuck there. :)

In this page (http://db.apache.org/derby/faq.html#schema_exist),
It says...
----------------------
4.3. Why do I get the error 'schema does not exist'? 
 
The current schema for any connection defaults to a schema corresponding to the user name.
If no user name is supplied then the user name (and hence current schema) defaults to APP.


However even though the current schema is set to the user name, that schema may not exist.
A schema is only created by CREATE SCHEMA or creating an object (table etc.) in that schema
(this is implicit schema creation). 

The one exception to this is the APP schema, which is always created, though applications
should not depend on that. 

So you will see the schema not exists error if your application tries to access the current
schema before any objects have been created in it. Possibilities are you try to perform a
DROP TABLE before creating it, or try to SELECT from a table to see if it should be created
or not, or when there is a problem with the sql for the very first object you try to create
in a particular schema and no explicit CREATE SCHEMA was issued. 

----------------------

So what you have to do is
First, you should comment out or remove both
derby.authentication.provider and derby.user.foo lines in
derby.properties.
Second, restart Derby.
Third, connect to Derby and commit a "CREATE SCHEMA foo;" SQL.
Forth, put back both two lines you removed at the first to
derby.properties.
Fifth, restart Derby.
Sixth, Access to Derby programatically like below.
-----------------------
            String dbURL = "jdbc:derby://localhost:1527/MyDB"; // where
MyDB is the name of your database.
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            Properties prop = new Properties();
            prop.put("user","foo");
            prop.put("password","foo");
            //prop.put("retreiveMessagesFromServerOnGetMessage","true");
            Connection conn = DriverManager.getConnection(dbURL, prop); 
-----------------------
or from ij.
-----------------------
if you access to the embedded Derby,
ij> connect 'jdbc:derby:MyDB;user=foo;password=foo';
or
if you access to Derby booted as server.
ij> connect 'jdbc:derby://localhost:1527/MyDB;user=foo;password=foo';
-----------------------


Regards,
Wolfgang



--------------------------------------
Know more about Breast Cancer
http://pr.mail.yahoo.co.jp/pinkribbon/


Mime
View raw message