今天爱分享给大家带来JAVA 如何实现向数据库添加一列?【面试题详解】,希望能够帮助到大家。
Connection con = null; ResultSet rs = null; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=db_name"; Connection con = DriverManager.getConnection(url,"",""); StateManager sm =con.createStateMent(); String sql = " alter table student add age int; "; rs = sm.excute(sql);