?????????????????Щ??????
???????????? ???????[ 2013/9/9 14:47:28 ] ????????
????2???Щ???????????
public class Chanage {
//int to String
public static String IntToString(int i){
String s = Integer.toString(i);
return s;
}
//String to int
public static int StringToInt(String s){
int i = Integer.parseInt(s);
return i;
}
}
????3???????????
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.mysql.jdbc.Connection;
class ConnMySQL {
Connection conn;
Statement stmt;
ResultSet rs1;
int rs2;
public void connection() throws Exception{
String db = "meeting";
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://172.16.3.9:3306/"+db;
String uname = "admin";
String pwd = "itserver";
//????????
Class.forName(driver);
//?????????
conn = (Connection) DriverManager.getConnection(url?? uname?? pwd);
if(!conn.isClosed()){
//System.out.println("??????!");
}
}
//??в??????????ResultSet????
public void executeSql0(String sql) throws SQLException{
//?????????????????sql???
stmt = conn.createStatement();
//???sql
rs1 = stmt.executeQuery(sql);
while(rs1.next()){
String name = rs1.getString("meetingId");
String subject = rs1.getString("e164");
String regionName = rs1.getString("state");
System.out.println(name+" "+subject+" "+regionName);
}
rs1.close();
}
//??в??????????ResultSet????
public void executeSql1(String sql) throws SQLException{
//?????????????????sql???
stmt = conn.createStatement();
//???sql
rs1 = stmt.executeQuery(sql);
while(rs1.next()){
String id = rs1.getString("id");
String subject = rs1.getString("subject");
String startTime = rs1.getString("startTime");
String endTime = rs1.getString("endTime");
String organiger = rs1.getString("organiger");
String status = rs1.getString("status");
System.out.println(id+" "+subject+" "+startTime+" "+endTime+" "+organiger+" "+status);
}
rs1.close();
conn.close();
}
//???????????????int????
public void executeSql2(String sql) throws SQLException{
stmt = conn.createStatement();
rs2 = stmt.executeUpdate(sql);
stmt.close();
conn.close();
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11