我尝试使用以下代码从 eclipse 模拟器 android 连接到 sql 服务器:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
String driver = "net.sourceforge.jtds.jdbc.Driver";
Class.forName(driver).newInstance();
String connString = "jdbc:jtds:sqlserver://83.212.240.15:1521/hua;encrypt=false;user=xxxxxx;password=xxx;instance=SQLEXPRESS;";
String username = "xxxxx";
String password = "xxxxx";
conn = DriverManager.getConnection(connString,username,password);
Statement stmt = conn.createStatement();
ResultSet reset = stmt.executeQuery("insert into picture values('hi');");
conn.close();
但在数据库中没有任何反应。有什么想法吗?
提前致谢