shiyan1连接oracle数据库试验
来源:互联网 发布:淘宝出售可非大力小泰 编辑:程序博客网 时间:2024/06/06 01:51
package ccwp;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
public class shiyan1 {
private static String db_config="db_config.properties";
public static String DRIVERS=null;
public static String USER=null;
public static String URL=null;
public static String PASSWORD=null;
public static long V_WAYBILLNO2;
static{
Properties props=new Properties();
InputStream inStr=null;
try{
inStr=ClassLoader.getSystemResourceAsStream(db_config);
props.load(inStr);
}catch (IOException e){
e.printStackTrace();
}
DRIVERS=props.getProperty("drivers");
URL=props.getProperty("url");
USER=props.getProperty("user");
PASSWORD=props.getProperty("pwd");
}
public static Connection getConnection(){
Connection con = null;
try{
con = DriverManager.getConnection(URL , USER , PASSWORD ) ;
}catch(SQLException se){
System.out.println("数据库连接失败!");
se.printStackTrace() ;
}
return con;}
/**
* @param args
*/
public static void main(String[] args) {
Connection con = getConnection();
Statement statement = null;
String sql0=null;
long V_WAYBILLNO_long=0;
String V_WAYBILLNO="";
// TODO Auto-generated method stub
try {
statement=con.createStatement();
sql0="select max(t.waybill_no) max_no from tt_bar_record t where t.waybill_no like '723%'";
ResultSet result = statement.executeQuery(sql0);
while(result.next()){
V_WAYBILLNO_long=result.getLong("max_no");
}
V_WAYBILLNO_long=V_WAYBILLNO_long+1;
V_WAYBILLNO=String.valueOf(V_WAYBILLNO_long);
//System.out.println(V_WAYBILLNO_long);//打印出要测试的运单号
System.out.println(V_WAYBILLNO);//打印出要测试的运单号
}
catch (SQLException e) {
e.printStackTrace();
}
}
public String receive_Bno(){
Connection con = getConnection();
Statement statement = null;
String sql0=null;
long V_WAYBILLNO_long=0;
String V_WAYBILLNO="";
// TODO Auto-generated method stub
try {
statement=con.createStatement();
sql0="select max(t.waybill_no) max_no from tt_bar_record t where t.waybill_no like '723%'";
ResultSet result = statement.executeQuery(sql0);
while(result.next()){
V_WAYBILLNO_long=result.getLong("max_no");
}
V_WAYBILLNO_long=V_WAYBILLNO_long+1;
V_WAYBILLNO=String.valueOf(V_WAYBILLNO_long);
//System.out.println(V_WAYBILLNO_long);//打印出要测试的运单号
System.out.println(V_WAYBILLNO);//打印出要测试的运单号
}
catch (SQLException e) {
e.printStackTrace();
}
return V_WAYBILLNO;
}
}
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
public class shiyan1 {
private static String db_config="db_config.properties";
public static String DRIVERS=null;
public static String USER=null;
public static String URL=null;
public static String PASSWORD=null;
public static long V_WAYBILLNO2;
static{
Properties props=new Properties();
InputStream inStr=null;
try{
inStr=ClassLoader.getSystemResourceAsStream(db_config);
props.load(inStr);
}catch (IOException e){
e.printStackTrace();
}
DRIVERS=props.getProperty("drivers");
URL=props.getProperty("url");
USER=props.getProperty("user");
PASSWORD=props.getProperty("pwd");
}
public static Connection getConnection(){
Connection con = null;
try{
con = DriverManager.getConnection(URL , USER , PASSWORD ) ;
}catch(SQLException se){
System.out.println("数据库连接失败!");
se.printStackTrace() ;
}
return con;}
/**
* @param args
*/
public static void main(String[] args) {
Connection con = getConnection();
Statement statement = null;
String sql0=null;
long V_WAYBILLNO_long=0;
String V_WAYBILLNO="";
// TODO Auto-generated method stub
try {
statement=con.createStatement();
sql0="select max(t.waybill_no) max_no from tt_bar_record t where t.waybill_no like '723%'";
ResultSet result = statement.executeQuery(sql0);
while(result.next()){
V_WAYBILLNO_long=result.getLong("max_no");
}
V_WAYBILLNO_long=V_WAYBILLNO_long+1;
V_WAYBILLNO=String.valueOf(V_WAYBILLNO_long);
//System.out.println(V_WAYBILLNO_long);//打印出要测试的运单号
System.out.println(V_WAYBILLNO);//打印出要测试的运单号
}
catch (SQLException e) {
e.printStackTrace();
}
}
public String receive_Bno(){
Connection con = getConnection();
Statement statement = null;
String sql0=null;
long V_WAYBILLNO_long=0;
String V_WAYBILLNO="";
// TODO Auto-generated method stub
try {
statement=con.createStatement();
sql0="select max(t.waybill_no) max_no from tt_bar_record t where t.waybill_no like '723%'";
ResultSet result = statement.executeQuery(sql0);
while(result.next()){
V_WAYBILLNO_long=result.getLong("max_no");
}
V_WAYBILLNO_long=V_WAYBILLNO_long+1;
V_WAYBILLNO=String.valueOf(V_WAYBILLNO_long);
//System.out.println(V_WAYBILLNO_long);//打印出要测试的运单号
System.out.println(V_WAYBILLNO);//打印出要测试的运单号
}
catch (SQLException e) {
e.printStackTrace();
}
return V_WAYBILLNO;
}
}
0 0
- shiyan1连接oracle数据库试验
- oracle 连接 oracle数据库
- 连接ORACLE数据库
- Oracle数据库的连接
- Java连接Oracle数据库
- oracle连接数据库
- 连接Oracle数据库
- JAVA 连接ORACLE数据库
- java连接oracle数据库
- jsp连接数据库oracle
- C#连接Oracle数据库
- VB连接ORACLE数据库
- JBuilder连接oracle数据库
- java连接oracle数据库
- C#连接oracle数据库
- Oracle数据库中的(+)连接
- jdbc连接oracle数据库
- ASP连接oracle数据库
- GPIO ,ioctl,file->private_data
- android edittext中输入特定字符 inputtype digits
- “could not open perfmemory” / “local java applications cannot be monitored“
- freemarker教程
- 生成子集——位向量法
- shiyan1连接oracle数据库试验
- MySQLWorkbench 双击无反应
- 一个App完成入门篇(三)-完善主框架 企
- 在Android应用中读取彩信文件
- Windows 和Linux利用tftp协议传送文件
- Android ListView获取当前可视区域条目数据
- test1000
- 《python计算机视觉编程》读书笔记------5(Numpy篇)
- C++构造函数和拷贝构造函数等的使用