db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Kam" <moonblade.w...@gmail.com>
Subject User and Password in Derby ..
Date Fri, 27 Jun 2008 12:29:26 GMT
Hello again Derby,

I hope i dont spam too much today, lol ..

Anyway .. imagine this case (another experience of this newb today) :

Im going to use a 3rd party library that doesnt use datasource, but a
properties file.
And a simple properties file is going to contain entries about the driver,
the jdbc url, and of course the username and password pair.

So, if i'm going to use a ClientDriver approach of Derby, i'll have to fill
in the properties file, and ..
I leave the username and password field blank .. They become something like
this :
db1.url=jdbc:derby://localhost:1527/test
db1.driver=org.apache.derby.jdbc.ClientDriver
db1.username=
db1.password=

And then i do a little testing, and i received this error :
Exception in thread "main" java.sql.SQLException: User id length (0) is
outside the range of 1 to 255.
    at
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown
Source)
    at org.apache.derby.client.am.SqlException.getSQLException(Unknown
Source)
    at org.apache.derby.jdbc.ClientDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at sofco.Test.testInsert(Test.java:19)
    at sofco.Test.main(Test.java:14)
Caused by: org.apache.derby.client.am.SqlException: User id length (0) is
outside the range of 1 to 255.
    at org.apache.derby.client.net.NetConnection.checkUserLength(Unknown
Source)
    at org.apache.derby.client.net.NetConnection.checkUser(Unknown Source)
    at org.apache.derby.client.net.NetConnection.checkUserPassword(Unknown
Source)
    at org.apache.derby.client.net.NetConnection.flowConnect(Unknown Source)
    at org.apache.derby.client.net.NetConnection.<init>(Unknown Source)
    at
org.apache.derby.client.net.ClientJDBCObjectFactoryImpl.newNetConnection(Unknown
Source)
    ... 5 more

Later when i checked ... i found out that the 3rd party tool (which is
opensource, good lord) uses the ubiquitous approach of fetching simple
connection :
DriverManager.getConnection(jdbcURL, user, password);

I know if i were to use DriverManager.getConnection(jdbcURL); things are
going to be fine.

So if i couldnt changing the source, perhaps because of the license i'm not
familiar about (i hate reading license), i have to supply a legitimate user
and password ..

So i tried entering A for the username, and A for the password .. and an
error popped out :
Exception in thread "main" java.sql.SQLException: Schema 'A' does not exist
    at
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown
Source)
    at org.apache.derby.client.am.SqlException.getSQLException(Unknown
Source)
    at org.apache.derby.client.am.Statement.executeQuery(Unknown Source)
    at sofco.Test.testInsert(Test.java:22)
    at sofco.Test.main(Test.java:14)
Caused by: org.apache.derby.client.am.SqlException: Schema 'A' does not
exist
    at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
    at
org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown
Source)
    at
org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown
Source)
    at
org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown
Source)
    at
org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown
Source)
    at
org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown
Source)
    at
org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown
Source)
    at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
    at org.apache.derby.client.am.Statement.executeQueryX(Unknown Source)
    ... 3 more

I was stunned by the error message "Schema 'A' does not exist", because i
dont intend to play with schema.
And then i test supplying "app" for the username, and any char or string for
the password, as long it's not empty,
and things went smoothly.

Please help me by pointing which documentation should i read concerning the
user and password ..  =)

-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

Mime
View raw message