ASP,JAVA,.NET与数据库连接

ASP:

<%
  set conn = server.CreateObject("adodb.connection")
  conn.connectionstring = "Provider=sqloledb;User Id=sa;Password=123;Inital Catalog=pigeon;Data source=."
 'Provider=SQLOLEDB.1;Persist Security Info=True;User ID=用户名;Password=密码;Initial Catalog=数据库名;Data Source=SQL服务器名
%>

JAVA:

jdbc转odbc
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("jdbc:odbc:数据源名称","sa","");


jdbc直连
"url:jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=数据库名称"
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
conn = DriverManager.getConnection(jdbcurl,"sa","");

.Net

conn = new SqlConnection("Data Source=.;Initial Catalog=pigeon;uid=sa;pwd=");
conn.Open();

你可能感兴趣的:(数据库连接)