MySQL|使用Java Spring消费MySQL中的数据库存储过程( 二 )
Beans.xml:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd "><bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="https://www.360kuai.com/com.mysql.jdbc.Driver"/> <property name="url" value="https://www.360kuai.com/jdbc:mysql://localhost:3306/TEST"/> <property name="username" value="https://www.360kuai.com/root"/> <property name="password" value="https://www.360kuai.com/123456"/> bean>
<bean id="studentJDBCTemplate"class="com.sap.StudentJDBCTemplate"> <property name="dataSource" ref="dataSource" />bean>beans> 执行MainApp.java前,先清空student数据库表:
truncate table student;
文章图片
输出:
文章图片Jul 30, 2020 1:20:46 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefreshINFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@32a1bec0: startup date [Thu Jul 30 13:20:46 CST 2020]; root of context hierarchyJul 30, 2020 1:20:46 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitionsINFO: Loading XML bean definitions from class path resource [Beans.xml]Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.Jul 30, 2020 1:20:46 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassNameINFO: Loaded JDBC driver: com.mysql.jdbc.Driver------Records Creation--------Created Record Name = Zara Age = 11Created Record Name = Nuha Age = 2Created Record Name = Ayan Age = 15------Listing Multiple Records--------ID : 1, Name : Zara, Age : 11ID : 2, Name : Nuha, Age : 2ID : 3, Name : Ayan, Age : 15----Listing Record with ID = 2 -----ID : 2, Name : Nuha, Age : 2
【来源:汪子熙的游泳故事】
【 MySQL|使用Java Spring消费MySQL中的数据库存储过程】声明:转载此文是出于传递更多信息之目的。若有来源标注错误或侵犯了您的合法权益,请作者持权属证明与本网联系,我们将及时更正、删除,谢谢。 邮箱地址:newmedia@xxcb.cn
推荐阅读
- 电子身份证你用过没有?开通两月 4.6万余人次重庆市民使用登记住宿|电子身份证你用过没有?开通两月 4.6万余人次重庆市民使用登记住宿
- 减少门诊就医负担、个人账户使用范围扩大……你关心的医保改革都在这
- 优惠|全面实施电子客票后 购买使用学生票有什么变化?
- TSMC|台积电和Graphcore准备使用3纳米工艺制造AI加速芯片
- 安全|开车还在玩手机?重庆严查驾车时使用手机!监控自动抓拍还会曝光
- IT|英国拟允许临时授权紧急使用新冠疫苗
- 疫苗|英国拟允许临时授权紧急使用新冠疫苗
- 法律|这个买卖不敢做?小心五年内名下手机卡、银行卡无法正常使用
- 女性|迷你世界:女性玩家使用的装扮代表着性格?看看你属于哪一种?
- 个人征信|正常使用花呗会影响个人信用?关于个人征信的这些谣言,你中招了吗?
