Re: Info about Torque
I have been running Torque 3.1 (Tomcat 4.x, MySQL, Linux) on production system since 2006 and it worked perfectly fine. Frank Nguyen From: Anas Mughal To: Apache Torque Users List Sent: Fri, September 17, 2010 11:42:37 AM Subject: RE: Info about Torque Thomas, The Torque project is pretty solid and worked very well for us on a medium size project (59 tables with many joins). Good luck. -Original Message- From: Thomas Fischer [mailto:fisc...@seitenbau.net] Sent: Friday, September 17, 2010 2:25 AM To: Apache Torque Users List Subject: Re: Info about Torque > I want to use Torque, but I want to hnow: the project still alive? The project is still alive. The current production version is 3.3. There is a tutorial available on the web site ( http://db.apache.org/torque/releases/torque-3.3/tutorial/index.html), this might help you to get started. > In this case, when version 4.0 will be released? There is no definite plan, and as always this depends on available time, but I very much doubt 4.0 will happen this year. Thomas - To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org - To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org
Torque/MySQL connection hung after a week
I use Tomcat 4.x + Torque 3.1.1 + MySQL (5.x). The # of frequent users is <10 but heavy; i.e. continuous 8hrs. My problem is that after a week or so, the db connection b/w Tomcat (Torque) and MySQL hung (Tomcat is still working fine w/ other transaction) and have to reboot. I experienced a lot w/ Torque.properties configuration; especially db-common section, but nothing helped. Attached is my Torque.properties file. Any help/pointers is greatly appreciated. Frank Nguyen- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Criteria.addSelectColumn problem
I have 3 tables, t1, t2 and t3. t3 table is just a join-ref table of t1 and t2 in such a way that t3.c2 is ref index to t1.c1 and t3.c3 is a ref index to t2.c1 (t3.c1 is index for t3 table). Thus, table t3 has many records w/ same value in column 2 and 3. What I want is to select only rows from table 3 with unique c3 values. The statement: "select * distinct from t3 where t3.c2 = " gives me 27 rows where many of them have the same c2= and c3=same number, obviously. (i.e. 4532, 4532, 4533, 4534, etc.) which is not what I wanted. All I want is to have distinctive rows with c3 unique. So, the following statement gives me exactly what I want: select c3 distinct from t3 where t3.c2= gives me 7 row with c3 distinctive (i.e. 4532, 4533, 4534, etc.) However, when I do it in Torque: crit.add (c2, ) crit.addSelectColumn (c3) crit.setDistinct(); Iterator results = t3Peer.doSelect(crit).iterator() would throw Exception at doSelect() because during the populateObject(), it found only 1 column instead of all columns as default to populate the data into it. So, to make it short, is there a way to select records from a table with a specified, distinctive column(s) in Torque? Thanks in advance, Frank Nguyen (408) 836-6235 (Cell)
Re: how can i Insert data into multiple table at a time
There is no difference b/w inserting into 1 table or multiple tables from a single form transaction. Read the tutorial at: http://db.apache.org/torque/releases/torque-3.1.1/user-guide.html If the second adding/inserting needs a ref index from previous inserted row, do something like: r1.save(); r2.setRefIndexId(r1.getIndex()); r2.save(); Hope this helps, Sasikumar Natarajan <[EMAIL PROTECTED]> wrote: Hi All, i am new to apache torque. How can i insert data in to multiple table at one time hit. Actually i have a form to get the user's input and need to insert data in multiple table . Please help me.. Thanks in Advance Sasi
Re: No DataSourceFactory configured
Were you able to connect to any other database than "recoverable" database? what driver did you use ? were you able to connect to recoverable database itself using JDBC test with the same username and password? Lastly, try using different different dsfactory to see if it works for you. Here is my sample setup with my youcaddy database. ## Using commons-dbcp torque.dsfactory.youcaddy.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory #torque.dsfactory.youcaddy.factory=org.apache.torque.dsfactory.PerUserPoolDataSourceFactor y torque.dsfactory.youcaddy.pool.defaultMaxActive=10 torque.dsfactory.youcaddy.pool.testOnBorrow=true torque.dsfactory.youcaddy.pool.validationQuery=SELECT 1 torque.dsfactory.youcaddy.connection.driver = org.gjt.mm.mysql.Driver torque.dsfactory.youcaddy.connection.url = jdbc:mysql://localhost/youcaddy torque.dsfactory.youcaddy.connection.user = bla torque.dsfactory.youcaddy.connection.password = bla Good luck ! "Owen B. Mehegan" <[EMAIL PROTECTED]> wrote: Hi, I've seen this question asked many times in the mailing list archives, but so far I can't figure out a solution to the problem in my case. I have a unit test that is using Easymock to create mock database objects to test against. When I run the test, it always fails with this error: java.lang.NullPointerException: There was no DataSourceFactory configured for the connection recoverable But my Torque.properties _does_ include a datasource called 'recoverable:' torque.dsfactory.recoverable.factory=com.friend.db.RecoverableDataSourceFactory torque.dsfactory.recoverable.pool.maxActive=1 torque.dsfactory.recoverable.pool.maxIdle=1 torque.dsfactory.recoverable.pool.maxWait=1000 torque.dsfactory.recoverable.pool.testOnBorrow=false torque.dsfactory.recoverable.pool.validationQuery=SELECT 1 torque.dsfactory.recoverable.connection.driver=com.mockrunner.mock.jdbc.MockDriver torque.dsfactory.recoverable.connection.url = java://foo torque.dsfactory.recoverable.connection.user = user torque.dsfactory.recoverable.connection.password = foo This entry is similar to others in the torque.properties, so I don't think the syntax is incorrect. What else could I be doing wrong? -- Owen B. Mehegan Database Framework QA Guy "He is a dangerous mixture of sophistication and recklessness which makes one anxious about his influence on other boys." [EMAIL PROTECTED] YIM: omehegan AIM: ottomaticjack GTalk: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Schema migration tool
That would be nice. I've just gone thru a major upgrade/migration that has new tables, new cols, modifiled cols, and it was headache. I thought I could backup mysql (backup from mysql admin ), then run new schema.sql, then restore the data. However, the backup insertion script assumes the cols unchanged. Not sure about torque's data export. I ended up running the diff b/w the new and old schema and writing a sql script to modify the database which is a pain. -Frank Raphaël Piéroni <[EMAIL PROTECTED]> wrote: Hi, Is there a tool which creates an sql of database migration taking : an url of the current database schema and the modified schema.xmlfile ? It would be usefull to create one for torque 3.1.1 (the one i use) and mysql (the db i use) It would also be usefull to have such a tool usable on maven1 (the one i use at work) Thanks in advance for any answer. Raphaël
Re: Torque connection problem - PROBLEM SOLVED.
YES, the problem's SOLVED. Many thanks to Alvaro !. The problem was indeed duplication of torque jar files under WEB-INF/lib. I had torque-3.0-b2.jar, torque-3.1.jar, and torque-gen-3.1.jar (I lazily copied them from my dev env; torque-3.1/lib to my deploy area; torque-3.1/web/WEB-INF/lib and they built into jar file). After I removed all and keep only torque-3.1.jar, it worked like a champ Alvaro Coronel <[EMAIL PROTECTED]> wrote: I once saw this kind of weird problem (nosuchmethod when you _know_ the class and method are there. It was due to a repeated .jar file in different folders. They were the same version, but the JVM got utterly confused. Removing the unnecessary one solved the problem. It wasn't anything related to Torque though... Have you checked Tomcat's other lib folders? Regards, Álvaro Coronel. Frank Nguyen wrote: Thanks, Tim. I am still debugging the problem :( I am running Jarkata 3.1.1a, Torque 3.1 on Windows 2000. The irony of this problem is that I am running 2 webapps; mine and stocktrack (sample app from Struts book) Both are connecting to the same mysql, different databses, though. I also used the same setting for another old app using Struts. My old app and stocktrack worked, but not the new one (error attached). I tried to mimic as much as possible from the other 2 apps in term of config but no luck. The only major different b/w those 2 apps and new one is that old ones, I used Struts, but new one is just simple servlet. My %ant -f build-torque.xml sql/insert-sql/load-sql worked fine with MySQL. So, it must be the jarkata setting. Here is what I did. Please see if I've missed anything: - webapps/myproject/WEB-INF/web.xml to include a Torque init servlet, reading Torque.properties (below) at boot time and init. I checked jarkata log file. It started. (attached) - webapps/myproject/WEB-INF/classes/Torque.properties (attached) - webapps/myproject/WEB-INF/classes/com/myproject/core/TorqueInit.class (to start at boot time). But when I run my POST servlet to run a simple insert, I got the error (error file attached): It appeared that the servlet executed but failed in Torque, getConnection. What does it mean NoSuchMethodError org.apache.torque.Torque.getConnection? I checked WEB-INF/lib and it has all the libs for Torque 3.1 there (I used the same set of libs in torque 3.1 gen I built for my app. What could be the problem ? Did I miss anything to set up the jarkata server ? THanks, Error: 500 Location: /myproject/servlet/com.myproject.core.AddClub Internal Servlet Error: java.lang.NoSuchMethodError: org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection; at org.apache.torque.util.Transaction.beginOptional(Transaction.java:118) at org.apache.torque.util.Transaction.begin(Transaction.java:100) at com.myproject.torque.BaseClub.save(BaseClub.java:1319) at com.myproject.torque.BaseClub.save(BaseClub.java:1300) at com.myproject.core.AddClub.doPost(AddClub.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513) at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567) at org.apache.tomcat.core.Handler.invoke(Handler.java:322) at org.apache.tomcat.core.Handler.service(Handler.java:235) at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516) at java.lang.Thread.run(Thread.java:536) Jim Caserta wrote: Frank, I have run into a similar situation. If you are sure you have the correct jar files, and no older versions, make sure your classLoader policy is "Multiple" in your server configuration. If it is set to "Single", you can be holding onto older classes. When I changed muine to Multipe, it corrected the issue. Jim --- Frank Nguyen wrote: > Hi, > > I have a nasty connection prob b/w my app and > MySQL and couldn'f figure out after 2 days. It > worked with a diff app before but not the latest > one. I have a simple servlet app trying to insert a > row into a table. I did have a Torque init servlet > and set it in WEB-INF/web.xml to start at boot time > (from the tom cat log file, it appeared that it > never started !!) but it wasn't sure if that is the > problem. I did have WEB-INF/classes/Torque.xml setup > correctly (cloned from a working stocktrack app from > Struts) w/ right user name and password. > >
Re: Torque connection problem
Thanks, Tim. I am still debugging the problem :( I am running Jarkata 3.1.1a, Torque 3.1 on Windows 2000. The irony of this problem is that I am running 2 webapps; mine and stocktrack (sample app from Struts book) Both are connecting to the same mysql, different databses, though. I also used the same setting for another old app using Struts. My old app and stocktrack worked, but not the new one (error attached). I tried to mimic as much as possible from the other 2 apps in term of config but no luck. The only major different b/w those 2 apps and new one is that old ones, I used Struts, but new one is just simple servlet. My %ant -f build-torque.xml sql/insert-sql/load-sql worked fine with MySQL. So, it must be the jarkata setting. Here is what I did. Please see if I've missed anything: - webapps/myproject/WEB-INF/web.xml to include a Torque init servlet, reading Torque.properties (below) at boot time and init. I checked jarkata log file. It started. (attached) - webapps/myproject/WEB-INF/classes/Torque.properties (attached) - webapps/myproject/WEB-INF/classes/com/myproject/core/TorqueInit.class (to start at boot time). But when I run my POST servlet to run a simple insert, I got the error (error file attached): It appeared that the servlet executed but failed in Torque, getConnection. What does it mean NoSuchMethodError org.apache.torque.Torque.getConnection? I checked WEB-INF/lib and it has all the libs for Torque 3.1 there (I used the same set of libs in torque 3.1 gen I built for my app. What could be the problem ? Did I miss anything to set up the jarkata server ? THanks, Error: 500Location: /myproject/servlet/com.myproject.core.AddClubInternal Servlet Error: java.lang.NoSuchMethodError: org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection; at org.apache.torque.util.Transaction.beginOptional(Transaction.java:118) at org.apache.torque.util.Transaction.begin(Transaction.java:100) at com.myproject.torque.BaseClub.save(BaseClub.java:1319) at com.myproject.torque.BaseClub.save(BaseClub.java:1300) at com.myproject.core.AddClub.doPost(AddClub.java:117) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513) at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567) at org.apache.tomcat.core.Handler.invoke(Handler.java:322) at org.apache.tomcat.core.Handler.service(Handler.java:235) at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516) at java.lang.Thread.run(Thread.java:536) Jim Caserta <[EMAIL PROTECTED]> wrote: Frank,I have run into a similar situation. If you are sureyou have the correct jar files, and no older versions,make sure your classLoader policy is "Multiple" inyour server configuration. If it is set to "Single",you can be holding onto older classes. When I changed muine to Multipe, it corrected theissue.Jim--- Frank Nguyen <[EMAIL PROTECTED]>wrote:> Hi,> > I have a nasty connection prob b/w my app and> MySQL and couldn'f figure out after 2 days. It> worked with a diff app before but not the latest> one. I have a simple servlet app trying to insert a> row into a table. I did have a Torque init servlet> and set it in WEB-INF/web.xml to start at boot time> (from the tom cat log file, it appeared that it> never started !!) but it wasn't sure if that is the> problem. I did have WEB-INF/classes/Torque.xml setup> correctly (cloned from a working stocktrack app from> Struts) w/ right user name and password. > > Based on the following error, what else could it be> the problem that I need to check ? > > Thanks in advance,> > > > > > java.lang.NoSuchMethodError: >org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection;> at >org.apache.torque.util.Transaction.beginOptional(Transaction.java:118)> at >org.apache.torque.util.Transaction.begin(Transaction.java:100)> at >com.youcaddy.torque.BaseClub.save(BaseClub.java:1319)> at >com.youcaddy.torque.BaseClub.save(BaseClub.java:1300)> at> com.youcaddy.core.AddClub.doPost(AddClub.java:102) > > at>javax.servlet.http.HttpServlet.service(HttpServlet.java:760)> at >javax.servlet.http.HttpServlet.service(HttpServlet.java:853)> at >org.apache.tomcat.facade.ServletHandler.doSTMService(
Re: Torque connection problem
Yes, they are both 3.1. Thanks, Florian Hopf <[EMAIL PROTECTED]> wrote: Hi, Frank Nguyen schrieb: > java.lang.NoSuchMethodError: > org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection; > at > org.apache.torque.util.Transaction.beginOptional(Transaction.java:118) at > org.apache.torque.util.Transaction.begin(Transaction.java:100) at > com.youcaddy.torque.BaseClub.save(BaseClub.java:1319) at > com.youcaddy.torque.BaseClub.save(BaseClub.java:1300) at > com.youcaddy.core.AddClub.doPost(AddClub.java:102) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at > javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at > org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513) > at > org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567) at > org.apache.tomcat.core.Handler.invoke(Handler.java:322) > at org.apache.tomcat.core.Handler.service(Handler.java:235) at > org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at > > Are you sure that you are using the same Torque version in your app and the app you have copied the setup and code from? Kind regards Florian -- /** * Florian Hopf * eMail [EMAIL PROTECTED] * www http://www.synyx.de * irc irc.synyx.de */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Frank Nguyen (408) 836-6235 (Cell)
Torque connection problem
Hi, I have a nasty connection prob b/w my app and MySQL and couldn'f figure out after 2 days. It worked with a diff app before but not the latest one. I have a simple servlet app trying to insert a row into a table. I did have a Torque init servlet and set it in WEB-INF/web.xml to start at boot time (from the tom cat log file, it appeared that it never started !!) but it wasn't sure if that is the problem. I did have WEB-INF/classes/Torque.xml setup correctly (cloned from a working stocktrack app from Struts) w/ right user name and password. Based on the following error, what else could it be the problem that I need to check ? Thanks in advance, java.lang.NoSuchMethodError: org.apache.torque.Torque.getConnection(Ljava/lang/String;)Ljava/sql/Connection; at org.apache.torque.util.Transaction.beginOptional(Transaction.java:118) at org.apache.torque.util.Transaction.begin(Transaction.java:100) at com.youcaddy.torque.BaseClub.save(BaseClub.java:1319) at com.youcaddy.torque.BaseClub.save(BaseClub.java:1300) at com.youcaddy.core.AddClub.doPost(AddClub.java:102) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.facade.ServletHandler.doSTMService(ServletHandler.java:513) at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:567) at org.apache.tomcat.core.Handler.invoke(Handler.java:322) at org.apache.tomcat.core.Handler.service(Handler.java:235) at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833) at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516) at java.lang.Thread.run(Thread.java:536) Frank Nguyen (408) 836-6235 (Cell)
problem with basePrefix
For some reasons, my rerun of 'ant -f build-torque.xml' generated all the base java files with format ${basePrefix}XXX.java and $basePrefixXXXPeer.java instead of BaseXXX.java and BaseXXXPeer.java. It also screw up the base class name as $basePrefixXXXPeer class as well. Do you know why ? Attached are my build.properties and build-torque.xml. Thanks in advance, -Frank Executing the create-db.sql script ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: java.sql.SQLException: Unable to connect to any hosts due to exception: Connection rejected
Hi, I kept getting the JDBC connection problem with mysql when running 'ant -f build-torque.xml create-db'. I tried both localhost and remote. I was able to connect using 'mysql -h 'localhost|remotename' -u root'. There must be something wrong, either with the jdbc driver, or the config files (attached). I have mysql-connector-java-3.0.9-stable-bin.jar installed under /torque/lib and j2sdkx.x.x/jre/lib/ext. Did I miss something else ? Thanks, Frank Nguyen BUILD FAILED file:D:/torque-gen-3.1/build-torque.xml:292: java.sql.SQLException: Unable to nnect to any hosts due to exception: java.net.ConnectException: Connection re ed: connect at org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java 2) at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:358) at org.apache.tools.ant.Task.perform(Task.java:317) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:334) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.Project.executeTargets(Project.java:1250) at org.apache.tools.ant.Main.runBuild(Main.java:610) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235) Executing the create-db.sql script ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TorqueDataModelTask not found error
Hi, I kept getting this error message while building: D:\torque-3.0-b4>ant -f build-torque.xml Buildfile: build-torque.xml BUILD FAILED file:D:/torque-3.0-b4/build-torque.xml:77: taskdef class org.apache.torque.task.TorqueDataModelTask cannot be found Total time: 15 seconds I downloaded and installed it straight for the CD. There is torque-3.0-b4.jar under torque-3.0-b4 dir and I also copied it into my java home j2sdk1.4.1_05/jre/lib/ext. The jar tvf command does show org.apache.torque.task.TorqueDataModelTask class is in the jar file. So, what eles could be wrong ? Thanks in advance, -Frank Executing the create-db.sql script ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]