社区
Java SE
帖子详情
请问各位,
java_jin
2002-07-01 10:54:46
我在工程java_jin里建的BatchUpdate文件,显示以下错误!!!!
java.lang.AbstractMethodError
at java_jin.BatchUpdate.main(BatchUpdate.java:34)
Exception in thread "main"
...全文
43
2
打赏
收藏
请问各位,
我在工程java_jin里建的BatchUpdate文件,显示以下错误!!!! java.lang.AbstractMethodError at java_jin.BatchUpdate.main(BatchUpdate.java:34) Exception in thread "main"
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
java_jin
2002-07-01
打赏
举报
回复
就是连接数据的方法呀,代码如下,
package java_jin;
import java.sql.*;
public class BatchUpdate
{
public static void main(String args[]) throws SQLException
{
ResultSet rs=null;
PreparedStatement ps=null;
String url="jdbc:oracle:thin:@195.100.130.55:1521:ora";
Connection con;
Statement stmt;
//加载数据库驱动
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
}catch(java.lang.ClassNotFoundException e)
{
System.err.print("ClassNotFound Exception:");
System.err.println(e.getMessage());
}
try{
con=DriverManager.getConnection(url,"hr","hr");
//提交连接请求
con.setAutoCommit(false);
stmt=con.createStatement();
stmt.addBatch("insert into table_1 values(1,'新概念1')");
stmt.addBatch("insert into table_1 values(2,'新概念2')");
stmt.addBatch("insert into table_1 values(3,'新概念3')");
int[] updateCounts=stmt.executeBatch();
con.commit();
con.setAutoCommit(true);
ResultSet uprs=stmt.executeQuery("select * from table_1");
while(uprs.next())
{
int id=uprs.getInt("id");
String xx=uprs.getString("name");
System.out.println(id +" "+ xx);
}
uprs.close();
stmt.close();
con.close();
}
catch(BatchUpdateException b)
{
System.err.println("--BatchUpdateException---");
System.err.println("SQLState:"+b.getSQLState());
System.err.println("Message:"+b.getMessage());
System.err.println("Vendor:"+b.getErrorCode());
System.err.println("Update Counts:");
int[] updateCounts=b.getUpdateCounts();
for(int i=0;i<updateCounts[i];i++)
{
System.err.print(updateCounts[i]+" ");
}
System.err.println(" ");
}
catch(SQLException ex)
{
System.err.println("--SQLException---");
System.err.println("SQLState:"+ex.getSQLState());
System.err.println("Message:"+ex.getMessage());
System.err.println("Vendor:"+ex.getErrorCode());
}
}
}
wjmmml
2002-07-01
打赏
举报
回复
你是不是实例化了一个抽象的方法,在main方法里面。
Spring系列第1篇:
请问
各位大佬为何要学spring?
Spring系列目标:从入门掌握一个高级开发所需要的技能。环境 jdk1.8ideamaven-3.6.1spring-5.2.3.RELEASE整个spring系列使用官方最新版本5....
请问
各位大神怎么从sql数据库里取出信息存到session里
我sql数据库表里有三个字段信息 ,分别是name ,pass ,nickname这是我登录验证的代码 ,因为登录只需要判断用户名和密码 ,我想在这个jsp页面判断正确后 ,把该账号的nickname保存到session里 ,以让其他页面获取显示。
请问
各位大神怎么改代码啊 ,求求。。。<% request.setCharacterEncoding("UTF-8"); %><% ...
请问
各位c语言中 a += b+10 是什么意思?
请问
各位c语言中 a += b+10 是什么意思?
请问
各位大佬 在vc 2019里这样为什么运行不了呢 c语言
请问
各位大佬 在vc 2019里这样为什么运行不了呢 c语言
VMware ESXI 6.5安装成功 后 管理页面网页不显示登录对话框?
请问
各位大侠,是什么原因
VMware ESXI 6.5安装成功 后 管理页面网页不显示登录对话框?
请问
各位大侠,是什么原因
Java SE
62,612
社区成员
307,332
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章