db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zahra" <w...@zguy.com>
Subject Re: The bookstore example
Date Mon, 09 Feb 2004 22:44:25 GMT
I found the tutorial similarly frustrating, but I did actually get a subset
of the tutorial going. I sucessfully created a book and publisher.

I am using mysql and also get the transaction warning, but it still works.

I had to manually execute the sql to pupulate the id broker table. If your
id broker table is empty, you will need to do that too. Although the
exception you are getting about a null url implies a config error -
somewhere.

It would be really helpful if someone who was familiar with torque could put
together a working example to share and highlight the key configuration
items.

----- Original Message ----- 
From: <hicnar_torque_list@o2.pl>
To: <torque-user@db.apache.org>
Sent: Tuesday, February 10, 2004 4:18 AM
Subject: The bookstore example


> Hi all,
>
> I'm trying to learn Torque, but the more I try, the more frustrated
> I get :(. I've started with the bookstore example. Everything was
> going smoothly untill I tried to run the example.
>
> I'm getting an exception that starts as follows.
>
> <cut>
> [WARN] IDBroker - -IDBroker is being used with db 'bookstore', which
> does not support transactions. IDBroker attempts to use transactions
> to limit the possibility of duplicate key generation.  Without
> transactions, duplicate key generation is possible if multiple JVMs
> are used or other means are used to write to the database.
> [DEBUG] Transaction - -called safeRollback with null argument
> java.sql.SQLException: The url cannot be null
> at java.sql.DriverManager.getConnection(DriverManager.java:489)
> at java.sql.DriverManager.getConnection(DriverManager.java:171)
> at
>
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(Dr
iverAdapterCPDS.java:205)
> at
>
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(Dr
iverAdapterCPDS.java:175)
> at
>
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.testCPDS(InstanceK
eyDataSource.java:753)
> at
>
org.apache.commons.dbcp.datasources.SharedPoolDataSource.registerPool(Shared
PoolDataSource.java:234)
> at
>
org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnection
AndInfo(SharedPoolDataSource.java:203)
> at
>
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(Inst
anceKeyDataSource.java:681)
> at
>
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(Inst
anceKeyDataSource.java:665)
> at
> org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:743)
> at org.apache.torque.Torque.getConnection(Torque.java:306)
> at
> org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
> at org.apache.torque.util.Transaction.begin(Transaction.java:100)
> at com.hicnar.db.BasePublisher.save(BasePublisher.java:484)
> at com.hicnar.db.BasePublisher.save(BasePublisher.java:465)
> at com.hicnar.runtime.TestIt.main(TestIt.java:27)
> rethrown as org.apache.torque.TorqueException: The url cannot be null
> at
> org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:755)
> at org.apache.torque.Torque.getConnection(Torque.java:306)
> at
> org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)
> at org.apache.torque.util.Transaction.begin(Transaction.java:100)
> at com.hicnar.db.BasePublisher.save(BasePublisher.java:484)
> at com.hicnar.db.BasePublisher.save(BasePublisher.java:465)
> at com.hicnar.runtime.TestIt.main(TestIt.java:27)
> Caused by: java.sql.SQLException: The url cannot be null
> at java.sql.DriverManager.getConnection(DriverManager.java:489)
> at java.sql.DriverManager.getConnection(DriverManager.java:171)
> at
>
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(Dr
iverAdapterCPDS.java:205)
> at
>
org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS.getPooledConnection(Dr
iverAdapterCPDS.java:175)
> at
>
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.testCPDS(InstanceK
eyDataSource.java:753)
> at
>
org.apache.commons.dbcp.datasources.SharedPoolDataSource.registerPool(Shared
PoolDataSource.java:234)
> at
>
org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnection
AndInfo(SharedPoolDataSource.java:203)
> at
>
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(Inst
anceKeyDataSource.java:681)
> at
>
org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getConnection(Inst
anceKeyDataSource.java:665)
> at
> org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:743)
> ... 6 more
>
> I use PostgreSQL 7.3 on Fedora Core 1. The JDK is 1.4_02.
> AFAIK PostgreSQL supports transactions, so what does the line
> "[WARN] IDBroker - -IDBroker is being used with db 'bookstore',
> which does not support transactions." mean?? Have I misconfigured
> anything??
>
> Do you know anybody who succeeded running the example armed only
> with the knowledge from
> http://db.apache.org/torque/tutorial/index.html ??
>
> For instance.. the Torque.properties init lines taken from the
> tutorial page should be like these:
>
> log4j.rootCategory = DEBUG, default
> log4j.appender.default = org.apache.log4j.FileAppender
> log4j.appender.default.file = ./torque.log
> log4j.appender.default.layout = org.apache.log4j.SimpleLayout
>
> torque.database.default = bookstore
> torque.database.bookstore.driver = org.gjt.mm.mysql.Driver
> torque.database.bookstore.url = jdbc:mysql://127.0.0.1/bookstore
> torque.database.bookstore.username = user
> torque.database.bookstore.password = password
>
> and there's nothing about the params for dsfactory!!??
>
> Fortunately Göschl Siegfried mentioned this in his post at
> http://www.mail-archive.com/torque-user@db.apache.org/msg01869.html
> helping me to go one step forward.
>
> My "Torque.properties" looks like follows
>
> log4j.rootCategory = DEBUG, default
> log4j.appender.default = org.apache.log4j.FileAppender
> log4j.appender.default.file = ./torque.log
> log4j.appender.default.layout = org.apache.log4j.SimpleLayout
>
> torque.database.default = bookstore
>
> torque.database.bookstore.adapter=postgresql
>
> torque.dsfactory.bookstore.factory=
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> torque.dsfactory.bookstore.pool.defaultMaxConnections=10
> torque.dsfactory.bookstore.pool.maxExpiryTime=3600
> torque.dsfactory.bookstore.pool.connectionWaitTimeout=10
> torque.dsfactory.bookstore.pool.testOnBorrow=true
>
> torque.database.bookstore.driver = org.postgresql.Driver
> torque.database.bookstore.url = jdbc:postgresql://127.0.0.1/bookstore
> torque.database.bookstore.username = hicnar
> torque.database.bookstore.password = mypass
>
> I'll be gratefull for any suggestions that might help me to run the
> example.
>
> Chris
>
> PS. In my oppinion such simple examples are intended for folks like
> me - who want a quick start in a new tech, but if they're incomplete
> or not working... well that's the best way to bias a novice against
> even a very interesting piece of tech.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message