import java.sql.*; public class DbInput { Connection src=null; Connection dest=null; Connection connformax=null; ConnPara srcPara; ConnPara destPara; public DbInput(){} public void dbInit() { DbXmlParser xmlparser=new DbXmlParser("dbs.xml"); srcPara=xmlparser.getSource(); destPara=xmlparser.getDest(); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver" ); Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); src = DriverManager.getConnection( srcPara.getUrl(), srcPara.getUsername(),srcPara.getPassword()); dest =DriverManager.getConnection( destPara.getUrl(), destPara.getUsername(),destPara.getPassword()); connformax= DriverManager.getConnection( destPara.getUrl(), destPara.getUsername(),destPara.getPassword()); } //捕获加载驱动程序异常 catch ( ClassNotFoundException cnfex ) { System.err.println( "装载 JDBC/ODBC 驱动程序失败。" ); |