15 lines
680 B
Java
15 lines
680 B
Java
import java.io.FileInputStream;
|
|
import java.sql.*;
|
|
import java.util.Properties;
|
|
public class FkCount {
|
|
public static void main(String[] args) throws Exception {
|
|
Properties props = new Properties();
|
|
try (FileInputStream in = new FileInputStream(args[0])) { props.load(in); }
|
|
try (Connection conn = DriverManager.getConnection(props.getProperty("url"), props.getProperty("username"), props.getProperty("password"));
|
|
Statement st = conn.createStatement();
|
|
ResultSet rs = st.executeQuery("SELECT COUNT(*) FROM sys.foreign_keys")) {
|
|
rs.next(); System.out.println("physical_fk_count=" + rs.getInt(1));
|
|
}
|
|
}
|
|
}
|