eclipse??Java????sql server?????
???????????? ???????[ 2016/9/6 10:23:27 ] ????????????? SQL Server
????import java.sql.Connection;
????import java.sql.DriverManager;
????import java.sql.ResultSet;
????import java.sql.SQLException;
????import java.sql.Statement;
????//????IDE?????eclipse
????//????SQL server????????????SQL server??????jar??????????·?? sqljdbc4.jar.
???????????£?
????1???????????? sqljdbc4.jar????jar??
????2??????jar????????????????????????????jar??
????3?????jar???????Build Path->Add to Build Path
????public class TestSQL {
????public static void main(String args[]) throws ClassNotFoundException?? SQLException{
????String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; //????sql server????·??
????String dbURL = "jdbc:sqlserver://localhost; DatabaseName=TestSQL"; //localhost??????????????? SQL server?????
????//???????????????????????????????
????String user = "sa"; //??????????????
????String pwd = "1234";//?????????????
????Connection dbConn;//????????
????Class.forName(driverName);//????????
????dbConn = DriverManager.getConnection(dbURL??user?? pwd);//???????
????Statement sta = dbConn.createStatement(); //???sql????????
????String str = "insert into Info values('?????'??'100')";//????SQL server???
????sta.executeUpdate(str);//???SQL server???
????sta.close();//???????
????dbConn.close();//???????
????}
????}
??????????eclipse??Java????sql server??????????????????????????? SQL Server????????.
??????
???·???
??????????????????
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