import java.util.Date;
import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.object.SqlFunction;
class Main {
public static void main(String args[]) throws Exception {
ApplicationContext ac = new ClassPathXmlApplicationContext("context.xml", Main.class);
DataSource dataSource = (DataSource) ac.getBean("dataSource");
//DataSource mysqlDataSource = (DataSource) ac.getBean("mysqlDataSource");
SqlFunction two = new SqlFunction(dataSource, "select 1+1 from dual");// for oralce
System.out.println(two.runGeneric());
}
}
|