?? test.java
字號:
package test;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.core.RowCountCallbackHandler;
public class Test {
public static void main(String[] args){
Resource resource=new ClassPathResource("myspring.xml");
BeanFactory factory=new XmlBeanFactory(resource);
JdbcTemplate jt=(JdbcTemplate)factory.getBean("dbtest");
jt.execute(SqlStatement.createSql);
jt.execute(SqlStatement.insertData1);
jt.execute(SqlStatement.insertData2);
jt.execute(SqlStatement.insertData3);
RowCountCallbackHandler rcch=new RowCountCallbackHandler();
jt.query(SqlStatement.selectsql,rcch);
System.out.println("緇撴灉闆嗕腑鐨勫垪鏁伴噺:"+rcch.getColumnCount());
System.out.println("緇撴灉闆嗕腑鐨勮
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -