Announcement Announcement Module
Collapse
No announcement yet.
configuring Stored Procedure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • configuring Stored Procedure

    I need to use stored procedure, using Spring JDBC template, but in the spring document i have seen the configurations are hardcoded in the code ie getting connection and all other stuffs,
    PHP Code:

    DriverManagerDataSource ds 
    = new DriverManagerDataSource();
            
    ds.setDriverClassName("oracle.jdbc.OracleDriver");
            
    ds.setUrl("jdbc:oracle:thin:@localhost:1521:mydb");
            
    ds.setUsername("scott");
            
    ds.setPassword("tiger");

            
    MyStoredProcedure sproc = new MyStoredProcedure(ds);
            
    Map results sproc.execute();
            
    printMap(results); 
    Is this examples shows that SP's, DB connection need to be hard coded?

    Here i dont want to hard code the clasname, url, i need to do configure in my Springdao.xml and inject the values?
    Last edited by kasim; Jun 14th, 2007, 11:08 PM.

  • #2
    This is purely for the examples. You can configure your dataSource in the applicationContext.xml and inject it. You can also extract your properties out to a file and use PropertyPlaceholderConfigurer to replace them for you. If in doubt have a look at the petclinic example.
    http://www.springframework.org/docs/...onfigurer.html
    Last edited by karldmoore; Aug 30th, 2007, 05:25 AM.

    Comment

    Working...
    X