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 "Petrula, Dan" <DP...@thezenith.com> on 2007/05/23 19:08:35 UTC
Password Authentication Failure
I am using a client-server configuration with the datebase located on a
separate server. If I set 'derby.connection.requireAuthentication=true'
,
'derby.authentication.provider=BUILTIN' , and 'derby.user.dan=danpass'
in the derby.properties file, I get the error message
SQLException:Schema 'DAN'
does not exist. I am passing a Properties object containing the password
name/value pairs as an attribute to the connection url
'conn=DriverManager.get
Connection(dbURL,prop);
I would like to set system-wide properties using the 'BUILTIN'
authenication provider. There are many examples in Derby documents
showing the
passing of a Properties object or just string value pairs combinations
to Derby.
However, I came upon a note on page 9 of "Tuning Derby" dated 12-11-06.
This notes says "If you pass in a Properties object as an argument to
the
DriverManager.getConnection call when connecting to the database, those
properties are used as a database connection URL attribute, not as
properties
of the type discussed in this book".
I am not sure how to interpret that statement. However, it seems to
imply that:
1. It is not possible to authenticate using system-wide properties
by passing a password name/value pair as an attribute.
2. The only way to validate by passing an attribute seems to be at
the database level.
3. I am assuming the use of the 'BUILTIN' authentication provider.
If I create the database using user=dan & password=danpass during the
creation process, I can connect to the database by passing the
Properties object
and setting derby.connection.requireAuthentication=true. If I don't set
the authentication and don't pass the Properties object, I can connect
to the database.
If I am correct in my numbered statements, what is the purpose of the
'BUILTIN' option as an authentication provider using system-wide
properties? It does not
appear that it can be used.
Of course maybe I just don't understand this authentication process.
Anyone have any comments?
Dan
**********************************************************************
NOTICE:
This e-mail, including attachments, contains information that may be confidential, protected by the attorney/client or other privileges, or exempt from disclosure under applicable law. Further, this e-mail may contain information that is proprietary and/or constitutes a trade secret. This e-mail, including attachments, constitutes non-public information intended to be conveyed only to the designated recipient(s). If you are not an intended recipient of this communication, please be advised that any disclosure, dissemination, distribution, copying, or other use of this communication or any attached document is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail and promptly destroy all electronic and printed copies of this communication and any attached documents.
**********************************************************************
Re: Password Authentication Failure
Posted by John Embretsen <Jo...@Sun.COM>.
Hi Dan,
I tried to understand what you are trying to do and what may be causing your
problems. I think the authentication scheme you have described works as
expected, and that it is mainly a matter of understanding what the manuals are
trying to convey. And the manuals may be confusing, so I don't blame you ;)
First, let me try to answer the questions from your first posting:
> However, I came upon a note on page 9 of "Tuning Derby" dated 12-11-06.
> This notes says "If you pass in a Properties object as an argument to the
> DriverManager.getConnection call when connecting to the database, those
> properties are used as a database connection URL attribute, not as
> properties
> of the type discussed in this book".
I think what this means is that you can set connection URL attributes by using
the Java concept of properties, using a Properties object. The attributes you
set on the URL are referred to as attributes in the manual. What is referred to
as properties in Derby are different, and are usually not relevant for a pure
client application, but only for the JVM running the Derby engine and/or server.
Derby properties are described in the Tuning guide, e.g.:
http://db.apache.org/derby/docs/dev/tuning/ctunproper22250.html
and in the Server and Administration guide, e.g:
http://db.apache.org/derby/docs/dev/adminguide/tadminconfigsettingnetwrokserverproperties.html
Derby connection attributes are described in the Development guide, e.g:
http://db.apache.org/derby/docs/dev/devguide/cdevdvlp51654.html
You can set the _attributes_ using a Properties object in the getConnection()
call, but if you try to set any of the _properties_ this way, it will probably
have no effect (at least not in a pure client setting).
> I am not sure how to interpret that statement. However, it seems to
> imply that:
>
> 1. It is not possible to authenticate using system-wide properties
> by passing a password name/value pair as an attribute.
I'm not sure I understand. If you specify users and passwords as well as
authentication provider and the "require authentication" property in a
derby.properties file before starting the server, these properties are
system-wide. Supplying user/password pairs as connection attributes (for example
as part of a Properties object) using the Client Driver will (should) then work.
> 2. The only way to validate by passing an attribute seems to be at
> the database level.
>
> 3. I am assuming the use of the 'BUILTIN' authentication provider.
>
> If I create the database using user=dan & password=danpass during the
> creation process, I can connect to the database by passing the
> Properties object
> and setting derby.connection.requireAuthentication=true. If I don't set
> the authentication and don't pass the Properties object, I can connect
> to the database.
Where do you set derby.connection.requireAuthentication=true? If you set it in
the client application it will to my understanding not have any effect.
If you set derby.connection.requireAuthentication=true in your derby.properties
file (or some other way in relation to the server JVM), you will not be able to
connect with invalid user/password or no user/password:
"Connection authentication failure occurred. Reason: userid or password invalid."
Now, to you second posting:
> I can connect to the database and select the data in the table without
> problem under both database configurations. If I set
> 'derby.connection.requireAuthentication=true',
> then I cannot connect at all to the database created without a
> name/password even using 'APP' and even adding 'derby.user.dan=danpass'
> in the derby.properties
> file. I can connect and select in the database created with a user
> name/password as long as I use that name/password combination. If I add
> another name in the
> derby.properties file, using derby.authentication.provider=BUILTIN I
> cannot connnect and get the Schema error.
You get the schema error because when you create a table in a database, that
table will by default be created in a schema that has the same name as the user
name. This schema will be created if it does not exist. If no user is specified,
the default schema 'APP' will be used.
So, if you create a database with a URL like this:
jdbc:derby://localhost:1527/mydatabase;create=true;user=dan;password=danpass
and create the table mytable ("CREATE TABLE mytable(a int)"), the table mytable
will be in the schema 'DAN'.
If you then try to connect to the same database using another (valid) user, e.g.:
jdbc:derby://localhost:1527/mydatabase;create=true;user=john;password=johnpass
you will get the connection, but if you try to perform queries against mytable
without specifying schema, like this:
SELECT * FROM mytable
then Derby won't know where to find mytable. By default it will look in the
user's default schema, but since there is no schema called 'JOHN' in this case,
an exception will be thrown.
If you do
SELECT * FROM DAN.mytable
it will (should) work, even for user john.
If you created the table in the APP schema (no user specified when creating),
then use
SELECT * FROM APP.mytable
> The connection statement is as follows:
>
> Properties prop = new Properties();
> prop.set("user","dan");
> prop.set("password","danpass");
Do you mean prop.setProperty(...)? I cannot see a set() method in
java.util.Properties.
> String driver = "org.apache.derby.jdbc.ClientDriver";
> String dbURL =
> "jdbc:derby://192.168.1.99:1527/usr/local/derby/database/secondDB";
Looks like you intended the database location to be absolute, but in that case
the URL is lacking an extra forward slash after the port number. Just mentioning
this in case you suddenly discover that your database is not where you thought
it would be.
I hope this helps, but don't hesitate to ask the list if you have further questions!
--
John
RE: Password Authentication Failure
Posted by "Petrula, Dan" <DP...@thezenith.com>.
I have been working with Derby for about a year in the embedded mode, so
I am not unfamilar with the product. I looked at the FAQ about the
schema exists
error. I have created a simple table and populated it. I created the
database in two different configuarations . One without a name and
password upon creation and
one with. The client is a Windows machine running XP and the server is
linux running Red Hat, connected by a LAN using TCP/IP.
I can connect to the database and select the data in the table without
problem under both database configurations. If I set
'derby.connection.requireAuthentication=true',
then I cannot connect at all to the database created without a
name/password even using 'APP' and even adding 'derby.user.dan=danpass'
in the derby.properties
file. I can connect and select in the database created with a user
name/password as long as I use that name/password combination. If I add
another name in the
derby.properties file, using derby.authentication.provider=BUILTIN I
cannot connnect and get the Schema error.
The connection statement is as follows:
Properties prop = new Properties();
prop.set("user","dan");
prop.set("password","danpass");
String driver = "org.apache.derby.jdbc.ClientDriver";
String dbURL =
"jdbc:derby://192.168.1.99:1527/usr/local/derby/database/secondDB";
Class.forName(driver).newInstance();
conn=DriverManager.getConnection(dbURL,prop);
I removed the statement 'derby.connection.requireAuthenticaion=true'
from the properties file and added it to the database directly using the
'call' statement.
I also added a few names using this method both using ij utility. The
database then required a user/name password, but the names I added were
not recognized when
I attempted to connect after changing my Properties object to those
names. I still got the same schema error.
I am at loss as to what to do or try next.
Dan
________________________________
From: Francois Orsini [mailto:francois.orsini@gmail.com]
Sent: Wednesday, May 23, 2007 5:45 PM
To: Derby Discussion
Subject: Re: Password Authentication Failure
Dan,
The error you posted is not an authentication failure one but It would
be great to get more info - The default schema is 'APP' when no user
name (or 'APP') is passed to connect to Derby. Are you trying to access
some tables which have not been created yet - That would cause this
error to be raised too...Are you getting this error right upon the
connection request or are you sending some statements - if you could
post all the attributes that you're passing to the
DriverManager.getConnection() call, that would be good too...
You might want to check this FAQ entry about this type of error:
http://db.apache.org/derby/faq.html#schema_exist
Derby's BUILTIN (default) authentication provider can be set at the
system or database level. The BUILTIN authentication scheme will use
system-wide properties if they have not been overriden by database
properties - users can be created at the system or / and database level
(database properties). If a user does not get authenticated
successfully, you should get an authentication failure error.
Also, user system properties are static ones, which means you will need
to restart the server for new ones to be taken into account...
Hope this helps a bit,
--francois
On 5/23/07, Petrula, Dan <DP...@thezenith.com> wrote:
I am using a client-server configuration with the datebase
located on a separate server. If I set
'derby.connection.requireAuthentication=true' ,
'derby.authentication.provider=BUILTIN' , and
'derby.user.dan=danpass' in the derby.properties file, I get the error
message SQLException:Schema 'DAN'
does not exist. I am passing a Properties object containing the
password name/value pairs as an attribute to the connection url
'conn=DriverManager.get
Connection(dbURL,prop);
I would like to set system-wide properties using the 'BUILTIN'
authenication provider. There are many examples in Derby documents
showing the
passing of a Properties object or just string value pairs
combinations to Derby.
However, I came upon a note on page 9 of "Tuning Derby" dated
12-11-06. This notes says "If you pass in a Properties object as an
argument to the
DriverManager.getConnection call when connecting to the
database, those properties are used as a database connection URL
attribute, not as properties
of the type discussed in this book".
I am not sure how to interpret that statement. However, it seems
to imply that:
1. It is not possible to authenticate using system-wide
properties by passing a password name/value pair as an attribute.
2. The only way to validate by passing an attribute seems to
be at the database level.
3. I am assuming the use of the 'BUILTIN' authentication
provider.
If I create the database using user=dan & password=danpass
during the creation process, I can connect to the database by passing
the Properties object
and setting derby.connection.requireAuthentication=true. If I
don't set the authentication and don't pass the Properties object, I can
connect to the database.
If I am correct in my numbered statements, what is the purpose
of the 'BUILTIN' option as an authentication provider using system-wide
properties? It does not
appear that it can be used.
Of course maybe I just don't understand this authentication
process.
Anyone have any comments?
Dan
**********************************************************************
NOTICE:
This e-mail, including attachments, contains information that
may be confidential, protected by the attorney/client or other
privileges, or exempt from disclosure under applicable law. Further,
this e-mail may contain information that is proprietary and/or
constitutes a trade secret. This e-mail, including attachments,
constitutes non-public information intended to be conveyed only to the
designated recipient(s). If you are not an intended recipient of this
communication, please be advised that any disclosure, dissemination,
distribution, copying, or other use of this communication or any
attached document is strictly prohibited. If you have received this
communication in error, please notify the sender immediately by reply
e-mail and promptly destroy all electronic and printed copies of this
communication and any attached documents.
**********************************************************************
Re: Password Authentication Failure
Posted by Francois Orsini <fr...@gmail.com>.
Dan,
The error you posted is not an authentication failure one but It would be
great to get more info - The default schema is 'APP' when no user name (or
'APP') is passed to connect to Derby. Are you trying to access some tables
which have not been created yet - That would cause this error to be raised
too...Are you getting this error right upon the connection request or are
you sending some statements - if you could post all the attributes that
you're passing to the DriverManager.getConnection() call, that would be good
too...
You might want to check this FAQ entry about this type of error:
http://db.apache.org/derby/faq.html#schema_exist
Derby's BUILTIN (default) authentication provider can be set at the system
or database level. The BUILTIN authentication scheme will use system-wide
properties if they have not been overriden by database properties - users
can be created at the system or / and database level (database properties).
If a user does not get authenticated successfully, you should get an
authentication failure error.
Also, user system properties are static ones, which means you will need to
restart the server for new ones to be taken into account...
Hope this helps a bit,
--francois
On 5/23/07, Petrula, Dan <DP...@thezenith.com> wrote:
>
> I am using a client-server configuration with the datebase located on a
> separate server. If I set 'derby.connection.requireAuthentication=true' ,
> 'derby.authentication.provider=BUILTIN' , and 'derby.user.dan=danpass' in
> the derby.properties file, I get the error message SQLException:Schema
> 'DAN'
> does not exist. I am passing a Properties object containing the password
> name/value pairs as an attribute to the connection url 'conn=
> DriverManager.get
> Connection(dbURL,prop);
>
> I would like to set system-wide properties using the 'BUILTIN'
> authenication provider. There are many examples in Derby documents showing
> the
> passing of a Properties object or just string value pairs combinations
> to Derby.
>
> However, I came upon a note on page 9 of "Tuning Derby" dated 12-11-06.
> This notes says "If you pass in a Properties object as an argument to the
> DriverManager.getConnection call when connecting to the database, those
> properties are used as a database connection URL attribute, not as
> properties
> of the type discussed in this book".
>
> I am not sure how to interpret that statement. However, it seems to imply
> that:
>
> 1. It is not possible to authenticate using system-wide properties by
> passing a password name/value pair as an attribute.
>
> 2. The only way to validate by passing an attribute seems to be at the
> database level.
>
> 3. I am assuming the use of the 'BUILTIN' authentication provider.
>
> If I create the database using user=dan & password=danpass during the
> creation process, I can connect to the database by passing the Properties
> object
> and setting derby.connection.requireAuthentication=true. If I don't set
> the authentication and don't pass the Properties object, I can connect to
> the database.
>
> If I am correct in my numbered statements, what is the purpose of the
> 'BUILTIN' option as an authentication provider using system-wide properties?
> It does not
> appear that it can be used.
>
> Of course maybe I just don't understand this authentication process.
>
> Anyone have any comments?
>
> Dan
>
> **********************************************************************
>
> NOTICE:
>
> This e-mail, including attachments, contains information that may be
> confidential, protected by the attorney/client or other privileges, or
> exempt from disclosure under applicable law. Further, this e-mail may
> contain information that is proprietary and/or constitutes a trade secret.
> This e-mail, including attachments, constitutes non-public information
> intended to be conveyed only to the designated recipient(s). If you are not
> an intended recipient of this communication, please be advised that any
> disclosure, dissemination, distribution, copying, or other use of this
> communication or any attached document is strictly prohibited. If you have
> received this communication in error, please notify the sender immediately
> by reply e-mail and promptly destroy all electronic and printed copies of
> this communication and any attached documents.
>
>
>
> **********************************************************************
>
>
>