JAVA简单问题
我重新在工程下创建了一个包,包里写了一个类;是为了节省代码量而写的JDBC语句。Java code:
package com.bbs.DBConnecion;
import java.sql.*;
public class ConnectionDB {
public static Connection getConnection(){
Connection conn=null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
conn=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=bbsDB","fanxiang","12345");
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
public static void closeConnection(Connection DBConnection){
try {
if(DBConnection!=null&&(!DBConnection.isClosed())){
DBConnection.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void closeResultSet(ResultSet rs){
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
rs=null;
}
相关问答:
不知道是什么原因,我该如何处理,请大虾们指教了,小弟在此谢过。。。。
错误信息如下:
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context t ......
工作地点:上海张江
学历要求:大本或以上
专业要求:计算机相关专业
英语:熟练(美国项目,英语工作环境,英语是必须)
简历投递:wendy_qian@163.com
MSN:wendydzmm@hotmail.com
......
查API,看到FeatrueFactory有这个方法
public Feature createPolyLine(double[][] thePoints,
R ......
[转]唐山迪锐软件公司:http://www.tsp2c.cn/youshi.htm
Java提供了两类主要的异常:runtime exception和checked exception。所有的checked exception是从java.lang.Exception类衍生出来的,而runtime exception则 ......
Java code:
package f;
public class TestStudent {
public static void main(String[] args) {
Student s1 = new Student();//创建父类对象
Xue x1 = new Xue();//创建子类对象;
s1.Set("张三 ......