⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mycallbackstatement.java

📁 自己做的3个spring的小例子
💻 JAVA
字号:
package sp.demo3;

import java.sql.CallableStatement;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.CallableStatementCallback;
import org.springframework.jdbc.core.JdbcTemplate;

public class MyCallbackStatement {
	public void doIt() throws SQLException {
		SpringDataSource sds = new SpringDataSource();
		sds.setUrl("jdbc:microsoft:sqlserver://192.168.1.36:1433;DatabaseName=PHSSAS04;SelectMethod=cursor;charset=CP936");
		sds.getConnection();
		DataSource ds = sds.getDataSource();

		JdbcTemplate jdbcTemplate = new JdbcTemplate();
		jdbcTemplate.setDataSource(ds);

		CallableStatementCallback cb = new CallableStatementCallback() {
			public Object doInCallableStatement(CallableStatement cs)
					throws SQLException, DataAccessException {
				cs.execute();
				return null;
			}
		};
		jdbcTemplate.execute("ldtel_generate_all '2005-03-28'", cb);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -