Hi, We can adjust the API to look something like http://nodejsdb.org/ and construct the jdbc url in the background.
Otherwise, we would always be exposing the "java way". On Mon, May 7, 2012 at 11:58 AM, Anjana Fernando <[email protected]> wrote: > Hi, > > On Mon, May 7, 2012 at 7:40 AM, Nuwan Bandara <[email protected]> wrote: > >> Hi Sameera, >> >> Right now I am using the default Datasources component for my Database >> API, it mandates to specify the Driver name. which is a limitation in >> tomcat. Anjana will provide patch so it will accommodate JDBC4 features. >> >> @Anjana please provide more context if I have missed any. >> > > Yeah, as Nuwan said, the jdbc-pool library makes it mandatory to provider > a driver name, which seems to be wrong, because mainly, they tried to keep > backward compatibility with DBCP by the same pooling properties and all, > but they have left out this functionality. I've created an issue here [1], > the fix is a very trivial one, hopefully it will be fixed soon. > > [1] https://issues.apache.org/bugzilla/show_bug.cgi?id=53198 > > Cheers, > Anjana. > > >> >> Regards, >> /Nuwan >> >> On Mon, May 7, 2012 at 10:56 AM, Sameera Jayasoma <[email protected]>wrote: >> >>> Hi Nuwan, >>> >>> Can you please try putting the JDBC driver to the >>> repository/components/extensions directory? Please clear the drivers in the >>> lib and dropins first. I've found some links which discussed this issue. >>> This is a typical OSGi world issue. The service provider factory SPI >>> concept in Java does not work in OSGi :) >>> >>> Thanks, >>> Sameera. >>> >>> http://hwellmann.blogspot.com/2009/04/jdbc-drivers-in-osgi.html >>> >>> >>> On Fri, May 4, 2012 at 5:01 PM, Nuwan Bandara <[email protected]> wrote: >>> >>>> Hi >>>> >>>> On Fri, May 4, 2012 at 4:54 PM, Sameera Jayasoma <[email protected]>wrote: >>>> >>>>> Hi Nuwan, >>>>> >>>>> How did you fix this? by passing DB driver name? >>>>> >>>> >>>> Yeah :( had no choice, The driver name is optional in JDBC4, but the >>>> tomcat datasource IMPL has written making it mandatory. Anjana told that he >>>> will submit a patch for that. even so, I dont think it will work in our >>>> OSGI environment. >>>> >>>> SO even though its ugly to specify a java class name in a Javascript >>>> API, we got no other option for now. >>>> >>>> Regards, >>>> /Nuwan >>>> >>>> >>>>> >>>>> Thanks, >>>>> Sameera. >>>>> >>>>> >>>>> On Fri, May 4, 2012 at 4:08 PM, Nuwan Bandara <[email protected]> wrote: >>>>> >>>>>> Hi Tharindu, >>>>>> >>>>>> This is now been fixed. the new API is documented in jaggery docs. >>>>>> >>>>>> Regards, >>>>>> /Nuwan >>>>>> >>>>>> >>>>>> On Tue, May 1, 2012 at 7:59 PM, Nuwan Bandara <[email protected]> wrote: >>>>>> >>>>>>> Hi >>>>>>> >>>>>>> On Tue, May 1, 2012 at 1:02 PM, Tharindu Mathew >>>>>>> <[email protected]>wrote: >>>>>>> >>>>>>>> Created jira for this: https://wso2.org/jira/browse/JAGGERY-209 ( >>>>>>>> A blocker IMO) >>>>>>> >>>>>>> >>>>>>> Will look into this. >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> Also, how can I set properties of the DB connection such as >>>>>>>> maxactive, minidle, timeouts? A minimum set of these should be >>>>>>>> supported by >>>>>>>> the API. >>>>>>>> >>>>>>> >>>>>>> You can append the properties to the connection URL. >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> Another question is how do I close the connection? I assume >>>>>>>> db.query() always opens and closes a DB connection. That is >>>>>>>> inefficient if >>>>>>>> I have a number of queries to run. >>>>>>>> >>>>>>> >>>>>>> True, will check on this. https://wso2.org/jira/browse/JAGGERY-210 >>>>>>> created. >>>>>>> >>>>>>> Thanks for the feedback Tharindu >>>>>>> >>>>>>> Regards, >>>>>>> /Nuwan >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Tue, May 1, 2012 at 1:42 AM, Tharindu Mathew >>>>>>>> <[email protected]>wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> Can $subject be done? It reports that the driver is missing. I >>>>>>>>> don't see anything in the docs about setting driver class name. >>>>>>>>> >>>>>>>>> Note: I added the jdbc driver to repository/components/lib as well >>>>>>>>> and checked >>>>>>>>> >>>>>>>>> Stacktrace: >>>>>>>>> >>>>>>>>> [2012-05-01 01:31:36,865] ERROR >>>>>>>>> {org.wso2.carbon.scriptengine.engine.RhinoEngine} - >>>>>>>>> org.mozilla.javascript.WrappedException: Wrapped >>>>>>>>> org.wso2.carbon.scriptengine.exceptions.ScriptException: Error >>>>>>>>> connecting >>>>>>>>> to the database : jdbc:mysql://localhost:3306/gadgetgen >>>>>>>>> (/gadgetgen/gadgetgen.jag#11) >>>>>>>>> [2012-05-01 01:31:36,865] ERROR >>>>>>>>> {org.wso2.carbon.jaggery.core.manager.WebAppManager} - >>>>>>>>> org.mozilla.javascript.WrappedException: Wrapped >>>>>>>>> org.wso2.carbon.scriptengine.exceptions.ScriptException: Error >>>>>>>>> connecting >>>>>>>>> to the database : jdbc:mysql://localhost:3306/gadgetgen >>>>>>>>> (/gadgetgen/gadgetgen.jag#11) >>>>>>>>> org.wso2.carbon.scriptengine.exceptions.ScriptException: >>>>>>>>> org.mozilla.javascript.WrappedException: Wrapped >>>>>>>>> org.wso2.carbon.scriptengine.exceptions.ScriptException: Error >>>>>>>>> connecting >>>>>>>>> to the database : jdbc:mysql://localhost:3306/gadgetgen >>>>>>>>> (/gadgetgen/gadgetgen.jag#11) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:477) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:231) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:212) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:42) >>>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) >>>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) >>>>>>>>> at >>>>>>>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) >>>>>>>>> at >>>>>>>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) >>>>>>>>> at >>>>>>>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) >>>>>>>>> at >>>>>>>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) >>>>>>>>> at >>>>>>>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) >>>>>>>>> at >>>>>>>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) >>>>>>>>> at >>>>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:109) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:155) >>>>>>>>> at >>>>>>>>> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) >>>>>>>>> at >>>>>>>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) >>>>>>>>> at >>>>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) >>>>>>>>> at >>>>>>>>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) >>>>>>>>> at >>>>>>>>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) >>>>>>>>> at >>>>>>>>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1620) >>>>>>>>> at >>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) >>>>>>>>> at >>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) >>>>>>>>> at java.lang.Thread.run(Thread.java:680) >>>>>>>>> Caused by: org.mozilla.javascript.WrappedException: Wrapped >>>>>>>>> org.wso2.carbon.scriptengine.exceptions.ScriptException: Error >>>>>>>>> connecting >>>>>>>>> to the database : jdbc:mysql://localhost:3306/gadgetgen >>>>>>>>> (/gadgetgen/gadgetgen.jag#11) >>>>>>>>> at >>>>>>>>> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1654) >>>>>>>>> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:175) >>>>>>>>> at >>>>>>>>> org.mozilla.javascript.FunctionObject.call(FunctionObject.java:417) >>>>>>>>> at >>>>>>>>> org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:328) >>>>>>>>> at >>>>>>>>> org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2266) >>>>>>>>> at org.wso2.carbon.rhino.c4._c0(/gadgetgen/gadgetgen.jag:11) >>>>>>>>> at org.wso2.carbon.rhino.c4.call(/gadgetgen/gadgetgen.jag) >>>>>>>>> at >>>>>>>>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401) >>>>>>>>> at >>>>>>>>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003) >>>>>>>>> at org.wso2.carbon.rhino.c4.call(/gadgetgen/gadgetgen.jag) >>>>>>>>> at org.wso2.carbon.rhino.c4.exec(/gadgetgen/gadgetgen.jag) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:472) >>>>>>>>> ... 23 more >>>>>>>>> Caused by: >>>>>>>>> org.wso2.carbon.scriptengine.exceptions.ScriptException: Error >>>>>>>>> connecting >>>>>>>>> to the database : jdbc:mysql://localhost:3306/gadgetgen >>>>>>>>> at >>>>>>>>> org.wso2.carbon.hostobjects.db.DatabaseHostObject.jsConstructor(DatabaseHostObject.java:112) >>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>>>>>> at >>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>>>>>>>> at >>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597) >>>>>>>>> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160) >>>>>>>>> ... 33 more >>>>>>>>> Caused by: java.sql.SQLException: No suitable driver found for >>>>>>>>> jdbc:mysql://localhost:3306/gadgetgen >>>>>>>>> at java.sql.DriverManager.getConnection(DriverManager.java:602) >>>>>>>>> at java.sql.DriverManager.getConnection(DriverManager.java:185) >>>>>>>>> at >>>>>>>>> org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75) >>>>>>>>> at >>>>>>>>> org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) >>>>>>>>> at >>>>>>>>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181) >>>>>>>>> at >>>>>>>>> org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) >>>>>>>>> at >>>>>>>>> org.wso2.carbon.hostobjects.db.DatabaseHostObject.jsConstructor(DatabaseHostObject.java:106) >>>>>>>>> ... 38 more >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Regards, >>>>>>>>> >>>>>>>>> Tharindu >>>>>>>>> >>>>>>>>> blog: http://mackiemathew.com/ >>>>>>>>> M: +94777759908 >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Regards, >>>>>>>> >>>>>>>> Tharindu >>>>>>>> >>>>>>>> blog: http://mackiemathew.com/ >>>>>>>> M: +94777759908 >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Dev mailing list >>>>>>>> [email protected] >>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> *Thanks & Regards, >>>>>>> >>>>>>> Nuwan Bandara >>>>>>> Associate Technical Lead & Member, MC, Development Technologies >>>>>>> WSO2 Inc. - lean . enterprise . middleware | http://wso2.com >>>>>>> blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 >>>>>>> 763 9629 >>>>>>> * >>>>>>> <http://www.nuwanbando.com/> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Thanks & Regards, >>>>>> >>>>>> Nuwan Bandara >>>>>> Associate Technical Lead & Member, MC, Development Technologies >>>>>> WSO2 Inc. - lean . enterprise . middleware | http://wso2.com >>>>>> blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 >>>>>> 763 9629 >>>>>> * >>>>>> <http://www.nuwanbando.com/> >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> [email protected] >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Sameera Jayasoma >>>>> Technical Lead >>>>> >>>>> WSO2, Inc. (http://wso2.com) >>>>> email: [email protected] >>>>> blog: http://tech.jayasoma.org >>>>> >>>>> Lean . Enterprise . Middleware >>>>> >>>> >>>> >>>> >>>> -- >>>> *Thanks & Regards, >>>> >>>> Nuwan Bandara >>>> Associate Technical Lead & Member, MC, Development Technologies >>>> WSO2 Inc. - lean . enterprise . middleware | http://wso2.com >>>> blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 763 >>>> 9629 >>>> * >>>> <http://www.nuwanbando.com/> >>>> >>> >>> >>> >>> -- >>> Sameera Jayasoma >>> Technical Lead >>> >>> WSO2, Inc. (http://wso2.com) >>> email: [email protected] >>> blog: http://tech.jayasoma.org >>> >>> Lean . Enterprise . Middleware >>> >> >> >> >> -- >> *Thanks & Regards, >> >> Nuwan Bandara >> Associate Technical Lead & Member, MC, Development Technologies >> WSO2 Inc. - lean . enterprise . middleware | http://wso2.com >> blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 763 >> 9629 >> * >> <http://www.nuwanbando.com/> >> > > > > -- > *Anjana Fernando* > Associate Technical Lead > WSO2 Inc. | http://wso2.com > lean . enterprise . middleware > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Regards, Tharindu blog: http://mackiemathew.com/ M: +94777759908
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
