Awesome; that's exactly what I was looking for.
I'm getting an exception I don't quite understand, now. Cayenne is
complaining about having "no current connection," but it has already
performed a single query and received results!
Apr 3, 2008 11:10:54 AM org.apache.cayenne.access.QueryLogger logQuery
INFO: SELECT t0.name, t0.description, t0.access, t0.cmdgroup, t0.id FROM
command t0 WHERE t0.name = ? [bind: 1->name:'access'] - prepared in 16
ms.
Apr 3, 2008 11:10:54 AM org.apache.cayenne.access.QueryLogger
logSelectCount
INFO: === returned 1 row. - took 125 ms.
Apr 3, 2008 11:10:54 AM org.apache.cayenne.access.QueryLogger
logCommitTransaction
INFO: +++ transaction committed.
Apr 3, 2008 11:10:54 AM org.apache.cayenne.access.QueryLogger
logQueryStart
INFO: --- will run 1 query.
Apr 3, 2008 11:10:54 AM org.apache.cayenne.access.QueryLogger
logBeginTransaction
INFO: --- transaction started.
Apr 3, 2008 11:10:54 AM org.apache.cayenne.access.QueryLogger
logQueryError
INFO: *** error.
java.sql.SQLTransientConnectionException: No current connection.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedConnection.checkIfClosed(Unknown Source)
at
org.apache.derby.impl.jdbc.EmbedConnection.getAutoCommit(Unknown Source)
at
org.apache.cayenne.access.InternalTransaction.fixConnectionState(Interna
lTransaction.java:48)
at
org.apache.cayenne.access.ExternalTransaction.addConnection(ExternalTran
saction.java:71)
at
org.apache.cayenne.access.DataNode$TransactionDataSource.getConnection(D
ataNode.java:322)
at
org.apache.cayenne.access.DataNode.performQueries(DataNode.java:209)
at
org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQuery
Action.java:416)
at
org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQue
ryAction.java:67)
at
org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQu
eryAction.java:389)
at
org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:84
7)
at
org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(Da
taDomainQueryAction.java:386)
at
org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryA
ction.java:119)
at
org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:740)
at
org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQ
ueryAction.java:304)
at
org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQu
eryAction.java:88)
at
org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1343)
at
org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1332
)
at
org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:2
75)
at net.bnubot.db.Command.get(Command.java:39)
at net.bnubot.core.Profile.registerCommand(Profile.java:32)
at
net.bnubot.bot.CommandEventHandler.initializeCommands(CommandEventHandle
r.java:123)
at
net.bnubot.bot.CommandEventHandler.<clinit>(CommandEventHandler.java:46)
at net.bnubot.core.Profile.insertConnection(Profile.java:109)
at net.bnubot.core.Profile.add(Profile.java:52)
at net.bnubot.core.Profile.newConnection(Profile.java:157)
at net.bnubot.Main.main(Main.java:106)
Caused by: java.sql.SQLException: No current connection.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcr
ossDRDA(Unknown Source)
... 30 more
Any ideas?
Thanks so much.
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: Thursday, April 03, 2008 10:11 AM
To: use..ayenne.apache.org
Subject: Re: How can I customize the driver/url/login
In the Modeler there is a dropdown for the DataNode called "DataSource
Factory". Here you can specify your own class that implements
"org.apache.cayenne.conf.DataSourceFactory" interface. Your own
factory can implement 'getDataSource' method to pop up a dialog asking
user to enter DB info on first call, or do whatever is appropriate in
your case.
Cheers,
Andrus
On Apr 3, 2008, at 3:38 AM, Scott Anderson wrote:
> Is there a way I can customize the driver/url/login information
> through
> my application code? I want the user to be able to select the location
> and login credentials, but the schema is known. I don't want the
> user to
> have to write his or her own configuration files and repackage the
> distributed jar, though.
>
This archive was generated by hypermail 2.0.0 : Thu Apr 03 2008 - 11:14:26 EDT