【澳门新萄京】jdbc的包裹

break;
case 3:
//更改数据
System.out.println(“订正前的数目”State of Qatar;
tool.mains();
System.out.println(“请输入您改革的号子:”卡塔尔;

import java.util.List;
import java.util.Map;

public class tool {

 

package com.com;

package com.oraec.jdbcutil;

2.调用类(执行类,测试类)

 

System.out.println(“请输入您增添的称号:”卡塔尔(قطر‎;
String name1 = sca.next();

实列运用

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

} catch (PropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*获得链接
*@return
*/
public static Connection getConnection(){
try {
return datasouce.getConnection();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}
}

import java.sql.SQLException;
import java.util.Scanner;

创建连接池

try {
num = sca.nextInt();
} catch (Exception e) {
System.out.println(“异常”);
break;
}

import com.oraec.jdbcutil.JDBCTemplate;

1.方法类

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.*;

try {
tool.add(num1, name1);
} catch (SQLException e) {
e.printStackTrace();
}
System.out.println(“增加后的数额–“卡塔尔;
tool.mains();
i=-i;
} else {
System.out.println(“输入内容有误,请输入4位数数字”卡塔尔国;
break;
}
}

 

public class test {

import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
* @throws Exception
*/
static Connection conn =null;
static Statement st =null;
static ResultSet rs =null;
public static void mains() {

 

try{
Class.forName(“oracle.jdbc.OracleDriver”);
conn
=DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521/XE”,”mysql”,”123456″);
st=conn.createStatement();
rs=st.executeQuery(“select numno,ename from dept”);

 

default:
System.out.println(“请输入规定的数字!”);
break;
}

public class Test {
public static void main(String[] args) {
String sql = “select * from past where name=?”;
JDBCTemplate jt = new JDBCTemplate();
List<Map<String, Object>> list = jt.queryForList(sql, new
Object[]{“asd”});
System.out.println(list.size());
}
}

}

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图