一个B/S的仓库管理系统放在买来的空间里,用JDBC连接数据库,SQL2000,
试用版用户使用的数据库名字为shiyong。一个正式版客户的数据库名为zhenshi。
在正式版客户使用系统的过程中,不知道怎么的就说连到shiyong上面去了,重新登录系统后又连接到zhenshi上.
请大家帮帮忙,看问题出在哪里,要怎么解决连接数据库的代码为:
package com.util
import java.sql.*;public class DBjdbc{
  private Connection conn=null;
  private Statement stmt=null;
  private ResultSet rs=null;
  private DBjdbc(){}
  public Static String url;
  public Static String dbname;
  public Static String user;
  public Static String psw;
  public Static DBjdbc dbjdbc; public static void setDbName(String ss,String ip,String name,String dbpsw){
   dbname = ss;
   url = ip;
   user = name;
   psw = dbpsw;
  }  public static DBjdbc getInstance(){
   if(dbjdbc == null){  dbjdbc = new DBjdbc();  }
   return dbjdbc;
  }
   
  private Connection getConnection() throws SQLException,ClassNotFoundException{
   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
   this.conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+url+":1433;ataBaseName="+dbname,user,psw);
    return conn;
  }
  
  public ResultSet querySQL(String strSql) throws SQLException,ClassNotFoundException{
   if(conn == null){ this.getConnection(); }
   this.stmt = conn.createStatement();
   rs = stmt.executeQuery(strSql);
   return rs;
  }  public int updateResult(String strSql) throws SQLException,ClassNotFoundException{
   if(conn == null){ this.getConnection(); }
   this.stmt = conn.createStatement();
   rs = stmt.executeUpdate(strSql);
   return rs;
  }  public void closeConn() throws SQLException{
    if(rs != null){
      rs.close();
      rs = null;
     }
     if(stmt!= null){
      stmt.close();
      stmt= null;
     }
     if(conn!= null){
      conn.close();
      conn= null;
     }
  }
}