Looks okay to me.. Do your logs oracle and tomcat say anything interesting? I also assume that you can connect to you oracle server and all relevant listeners are running on oracle.

This always worked for me on the occasions when i used this stuff.

ServletContext context = servlet.getServletContext();
DataSource ds = (DataSource) context.getAttribute("myConn");

try this in your config xml

<data-source key="myConn" type="org.apache.commons.dbcp.BasicDataSource">

I don't know about hibernate but i could do what you're saying it doesn't. torque will generate a schema from an exiting DB and then you can generate your OM from that schema. But if you've just gotta get it done the dataSource settings worked for me as before. Configuring a dataSource as per the tomcat docs is better than in struts but suffers the same problem that the connection stuff is best in your model.

Hope this helps

Mark


On Wednesday, August 13, 2003, at 01:50 PM, Jiri Chaloupka wrote:


Is it so simply you do not want to help or nobody knows? ...

Jiri Chaloupka wrote:

Hallo,
I cannot get DataSource in Struts.

in my strits-config.xml file is configured:
<data-source type="org.apache.commons.dbcp.BasicDataSource">
   <set-property
     property="driverClassName"
     value="oracle.jdbc.driver.OracleDriver" />
   <set-property
     property="url"
     value="jdbc:oracle:thin:@chaloupkaj.iccc.cz:1521:ordb" />
   <set-property
     property="username"
     value="xxx" />
   <set-property
     property="password"
     value="xxx" />
   <set-property
     property="maxActive"
     value="10" />
   <set-property
     property="maxWait"
     value="5000" />
   <set-property
     property="defaultAutoCommit"
     value="false" />
   <set-property
     property="defaultReadOnly"
     value="false" />
  </data-source>

and in my code:
public class TestList extends Action{
   HttpServletRequest request = null;
...
public int getList() throws Exception
   {
    DataSource ds = null;
     ....
     try{
           try{
               // try request object
               res.append("URI is "+request.getContextPath()+"<br>");
           }catch(Exception e){
               res.append("something wrong with request!!! <br>");
           }
           try{
                             ds = this.getDataSource(request);
               res.append("datasource ok <br>");
           }catch(Exception e){
               res.append("cannot get datasource!!! <br>");
               res.append("Fail: "+e.toString());
           }

etc...

and displays:
URI is /blabla
cannot get datasource!!!
Fail. : java.lang.NullPointerException

Is there anything else I must configure, or I badly undestand something else?
Or is there another way to do it better? I am new in Struts, reading manual, I was order some book (Programming Struts) but this book does not deliveder yet...
I cannot use Hibernate for this project becouse data into database will be writen by another way and as I understand hibernate layer should not know about its changes.


Thanks
Jiri


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to