jtds1.1連接sqlserver2000測試示例
public class TestSqlserverJtds {
public static void main(String[] args) {
Connection con=null;
try
{
String driver="net.sourceforge.jtds.jdbc.Driver";
String url="jdbc:jtds:sqlserver://192.168.0.15:1433;DatabaseName=test";
Class.forName(driver).newInstance();
System.out.println(" 連接開始。。。。。。");
long starttime = System.currentTimeMillis();
con =DriverManager.getConnection(url,"sa","123");
long endtime = System.currentTimeMillis();
System.out.println(" 連接成功 !Lost time:" + (endtime - starttime) / 1000 + "秒");
con.close();
} catch(Exception e) {
e.printStackTrace();
} finally{
try {
if(null != con){
con.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
相關文章
SpringBoot+Vue+Redis實現單點登錄(一處登錄另一處退出登錄)
小編接到一個需求,需要實現用戶在瀏覽器登錄后,跳轉到其他頁面,當用戶在其它地方又登錄時,前面用戶登錄的頁面退出登錄,這篇文章主要介紹了SpringBoot+Vue+Redis實現單點登錄,需要的朋友可以參考下2019-12-12Java FileInputStream與FileOutputStream使用詳解
這篇文章主要介紹了Java FileInputStream與FileOutputStream使用詳解,本篇文章通過簡要的案例,講解了該項技術的了解與使用,以下就是詳細內容,需要的朋友可以參考下2021-08-08