分类: Java
2006-06-28 15:28:39
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}catch(java.lang.ClassNotFoundException notClass){
System.out.println("no find the driver class");
}
try{
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs","sa","");
}catch(SQLException sqlE){
System.out.println("exception:"+sqlE.getMessage());
}