20260821230656
This commit is contained in:
1 parent
2e5d532f23
commit
c43b4c8364
144 files changed
+7665
-242
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import java.io.FileInputStream;
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
public class UserCheck {
|
||||
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"))) {
|
||||
try (Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT TOP 0 * FROM b_user")) {
|
||||
ResultSetMetaData meta = rs.getMetaData();
|
||||
System.out.println("== b_user columns ==");
|
||||
for (int i = 1; i <= meta.getColumnCount(); i++) {
|
||||
System.out.printf(" %-20s type=%s autoinc=%s%n", meta.getColumnName(i), meta.getColumnTypeName(i), meta.isAutoIncrement(i));
|
||||
}
|
||||
}
|
||||
try (Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT b_id, b_account, b_name FROM b_user")) {
|
||||
System.out.println("== b_user data ==");
|
||||
while (rs.next()) System.out.printf(" b_id=%s b_account=%s b_name=%s%n", rs.getString("b_id"), rs.getString("b_account"), rs.getString("b_name"));
|
||||
}
|
||||
try (Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT is_identity FROM sys.columns WHERE object_id=OBJECT_ID('b_user') AND name='b_id'")) {
|
||||
rs.next(); System.out.println("b_user.b_id is_identity=" + rs.getBoolean("is_identity"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user