package com.mstar.qs.auth.globe;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class TestGlobalDB {
public static void main(String[] args) {
Connection conn = null;
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
conn = DriverManager.getConnection(
"jdbc:jtds:sqlserver://host:1433;domain=msdomain1;useNTLMv2=true;DatabaseName=databasename;",
"username", "password");
if (conn != null)
System.out.println("globle database connect sucess");
else {
System.out.println("globle database connect failed");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class TestGlobalDB {
public static void main(String[] args) {
Connection conn = null;
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
conn = DriverManager.getConnection(
"jdbc:jtds:sqlserver://host:1433;domain=msdomain1;useNTLMv2=true;DatabaseName=databasename;",
"username", "password");
if (conn != null)
System.out.println("globle database connect sucess");
else {
System.out.println("globle database connect failed");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}