Hi Jason,
sorry for the hassle, but the new release is more strict in handling
different users. Thus OJB try to find a connection without user and
password,
because both fields were null (new PBKey("mydb")).
If you only use
one database per application and you set the default-connection
attribute
'true' it is possible to use
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
If it will help in your case I could do the following:
Granted that the jcdAlias name of the PBKey is matching
a jdbc-connection-descriptor and the default-connection was set 'true',
but user and password of the PBKey are 'null', then OJB could use the
user and password specified in the descriptor.
This will only work if default-connection is set 'true' and you
only could define one jdbc-connection-descriptor as the default
one. Would this solve your problem?
regards,
Armin
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 10, 2003 9:23 PM
Subject: PBKey and OJB 0.9.9
> Hi,
>
> I recently reconfigured our application to use the new 0.9.9 release.
> Previously we were using 0.9.8. We are using the PersistenceBroker
API.
> After reconfiguring our repository.xml file to use the new jcd-alias
> attribute on the connection descriptor, my connection descriptor is as
> follows:
>
> <jdbc-connection-descriptor
> jcd-alias="mydb"
> default-connection="true"
> useAutoCommit="1"
> platform="Hsqldb"
> jdbc-level="2.0"
> driver="org.hsqldb.jdbcDriver"
> protocol="jdbc"
> subprotocol="hsqldb"
> dbalias="/tmp/db/mydb"
> username="sa"
> password=""
> />
>
>
> In my code, I aquire the PersistenceBroker using this method:
>
> broker = PersistenceBrokerFactory.createPersistenceBroker( new
> PBKey( "mydb") );
>
>
> I am curious as to why it is now mandatory to supply the user name and
> password as part of the key now? I could always store it in another
file
> I suppose, but we are using multiple database platforms each of which
have
> a different username and password. The way this used to work was
great!
> Anyway that I can make it work as it did before? Is this going to
change
> back for OJB 1.0 or should I just start planning on getting the user
name
> and password from elsewhere instead of depending on the connection
> descriptor? Right now I receive the following exception ;-( :
>
> [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO:
> Create new connection
> pool:org.apache.ojb.broker.metadata.JdbcConnectionDescriptor@19f03d7[
> jcd-alias=mydb
> default-connection=false
> dbms=Hsqldb
> jdbc-level=2.0
> driver=org.hsqldb.jdbcDriver
> protocol=jdbc
> sub-protocol=hsqldb
> db-alias=/tmp/db/ams
> user=<null>
> password=*****
> eager-release=false
> ConnectionPoolDescriptor={testOnReturn=false, maxWait=5000,
> timeBetweenEvictionRunsMillis=-1, testOnBorrow=true,
> numTestsPerEvictionRun=10, maxActive=21, removeAbandonedTimeout=300,
> removeAbandoned=false, maxIdle=-1, testWhileIdle=false,
> whenExhaustedAction=0, logAbandoned=false,
> minEvictableIdleTimeMillis=600000}
> batchMode=false
> sequenceDescriptor=<null>
> ]
> [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl]
ERROR:
> Error getting Connection from DriverManager with url
> (jdbc:hsqldb:/tmp/db/ams) and driver (org.hsqldb.jdbcDriver)
> User not found:
> java.sql.SQLException: User not found:
>
> at org.hsqldb.Trace.getError(Unknown Source)
> at org.hsqldb.Trace.error(Unknown Source)
> at org.hsqldb.UserManager.get(Unknown Source)
> at org.hsqldb.UserManager.getUser(Unknown Source)
> at org.hsqldb.Database.connect(Unknown Source)
> at org.hsqldb.jdbcConnection.openStandalone(Unknown Source)
> at org.hsqldb.jdbcConnection.<init>(Unknown Source)
> at org.hsqldb.jdbcDriver.connect(Unknown Source)
> at
java.sql.DriverManager.getConnection(DriverManager.java:512)
> at
java.sql.DriverManager.getConnection(DriverManager.java:193)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConne
ctionFromDriverManager(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConPoolFac
tory.makeObject(Unknown
>
> Source)
> at
>
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjec
tPool.java:710)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnect
ionFromPool(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupCo
nnection(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Un
known
>
> Source)
> at
>
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(
Unknown
>
> Source)
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
> Source)
> at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
> Source)
> at
> org.apache.ojb.broker.accesslayer.ReportQueryRsIterator.<init>(Unknown
> Source)
> at
>
org.apache.ojb.broker.singlevm.ReportRsIteratorFactoryImpl.createRsItera
tor(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getRsIteratorFromQu
ery(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getReportQueryItera
torFromQuery(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getReportQueryItera
torByQuery(Unknown
>
> Source)
> at
>
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getReportQuer
yIteratorByQuery(Unknown
>
> Source)
>
>
>
> Thanks for the help!
>
> Jason
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]