打印本文 打印本文  关闭窗口 关闭窗口  
一个关于过程的源码
作者:佚名  文章来源:不详  点击数  更新时间:2008/4/18 11:25:03  文章录入:杜斌  责任编辑:杜斌

  一个关于过程的源码

  /*
  * Created on 2004-7-22
  *
  * To change the template for this generated file go to
  * Window>Preferences>Java>Code Generation>Code and Comments
  */

  /**
  * @author cw
  *
  * To change the template for this generated type comment go to
  * Window>Preferences>Java>Code Generation>Code and Comments
  */
  import java.awt.*;
  import javax.Swing.*;
  import java.awt.event.*;
  import java.sql.*;
  import java.util.*;
  public class ProcedureExample1 extends JFrame {

  private Statement stam;
  private Connection con;
  private ResultSet resultSet;
  private ResultSetMetaData rsMetaData;

  public JButton bty;
  public JLabel lb1;
  public JButton btsave;
  public JTable table;

  public ProcedureExample1()
  {
  super("关于存储过程");
  String url="JDBC:jtds:sqlserver://192.168.254.222:1433/currentdb";;
  String user="sa";
  String password="";
  try{
  /* Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
  con=DriverManager.getConnection("jdbc:microsoft:sqlserver://hxdz05:1433;databaseName=currentdb",user,password);
  */
  Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
  con= DriverManager.getConnection(
  url, user, password );
  }
  catch(ClassNotFoundException cnfex){
  System.err.println("装载JdBC驱动程序失败!");
  cnfex.printStackTrace();
  System.exit(1);
  }
  catch(SQLException sqlex){
  System.err.println("无法连接数据库");
  sqlex.printStackTrace();
  System.exit(1);
  }
  catch (InstantiationException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  catch (IllegalAccessException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  }
  //catch()

打印本文 打印本文  关闭窗口 关闭窗口