-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SOPANMISHRA,
On 12/10/2010 9:51 AM, SOPANMISHRA wrote: > 1.By normal jdbc process means without implementing any datasource concept in > tomcat for my project evrything is working fine. Glad to hear it. > It is just when i do > datasource config I'm facing "not supported by basic data source" against a > method that uses a stringbuilder to form a query by retrieving values from a > jsp page dynamically The source of the query is not relevant: whether you use a StringBuilder or a plain-old String (which is what you get, anyway), it's just a query to the JDBC driver. > if (Validation.validate(defRetrivalFields)) { > > [snip] > > } > return retStr; None of that code had anything to do with Hibernate or a DataSource. > 2.I tried various data source possible - <resource > type=javax.sql.DataSource/javax.sql.ConnectionPoolDataSource but to no avail Case matters: you need to have <Resource> in your configuration. You need to have type="javax.sql.DataSource", otherwise the DataSource won't be created at all (and you should get an error message in catalina.out). > 3.driverClassName="oracle.jdbc.driver.OracleDriver"/"oracle.jdbc.OracleDriver" > You might want to determine which one of these is more appropriate for you to use and stick with it. > 4.The complete java stack trace is while processing the soap message > request:- > > Dec 10, 2010 8:13:46 PM com.xxxxxxxx.care.agentevaluation.db.dao.xxxxxxxx > getAgentDetails > INFO: Query:SELECT coalesce(M.iataNo,' ') AS iataNo,coalesce(M.pcc,' ') AS > pcc FROM xxxxxxxx AS M WHERE M.pcc IN (:lst) ORDER BY M.iataNo,M.pcc > java.lang.UnsupportedOperationException: Not supported by BasicDataSource > at > org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:899) A call to getConnection will occur /before/ the query is executed. I suspect that if you were to issue the query "SELECT 1 FROM DUAL" you'd get the same error. I think this has nothing to do with your query at all. BasicDataSource.getConnection in DBCP-1.2.2 only throws UnsupportedOperationException when you call getConnection(String username, String password) on the DataSource. Does your Hibernate configuration specify a username and password? If so, you should remove those and allow Hibernate to use the pool without specifying credentials. I suspect this will clear-up your problem. > 5.I understand that datasource configuration is a separate entity and does > not depend on the SQL query i have written in my .java file that is fetched > using hibernate but still I want to enquire whether "coalesce" that i'm > using in the dynamic query creation is the culprit because the exception is > occurring when the method returning this processed query is returned as you > can see in the scriptlet No. No part of the query here is a problem. > 6.the <reqfieldtype,colHeaderRequired etc> and other are values saved into > session from user input page and then requested wherever required That doesn't make them trusted. > 7.I understand u are stressing on code optimization as > (stringbuilder,finally) but my main problem is the functionality that i have > to meet using data source and only after that I can stress upon code > enhancement.i have noted and will implement it.The fact is the project is in > testing environment and i have to implement the datasource and verify again > including final code optimization without which it cannot be tested and put > into production. Certainly correctness is key, but security is a part of correctness. Good luck, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk0CdyUACgkQ9CaO5/Lv0PCWTQCffTCmaueprea8cJbwN8xPz1FB 8b4AoIS93YHsnB9vHZ1hSynNfNVl/h4e =NE93 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org