[分享]用数据源(用数据源(ODBC)创建数据库连接DSN设置)创建数据库连接DSN设置
Asp连接数据库推荐用ACCESS+MSSQL / ASP+ACCESS Conn.open=”provider=microsoft.jet.oledb.4.0;data source=”&server.mappath(“数据库路径”) ASP+MSSQL Conn.open=”provider=sqloledb;server=127.0.0.1;uid=sa;pwd=admin;database=wm” ASP+MYSQL conn.open="driver={MYSQLODBC 3.51 DRIVER};uid=root;pwd=;database=HR_MOVE;server=127.0.0.1" ASP+SQLITE A conn.open="DSN=SQL_WM;DRIVER={SQLite3 ODBC Driver}" B conn.open="DRIVER={SQLite3 ODBC Driver};DATABASE=D:\SQLITE\WWWW" ASP+PostgreSQL conn.open="DRIVER={PostgreSQL ANSI};server=127.0.0.1;uid=itnows;pwd=000000;database=test1" php连接数据库推荐用PHP+MYSQL PHP+ACCESS $conn = new com("ADODB.Connection"); $connstr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("workermove.mdb"); $conn->Open($connstr); $rs = new com("ADODB.RecordSet"); $rs->Open(SQL语句,$conn,1,1); PHP+MSSQL $connstr = "DRIVER={SQL SERVER};SERVER=127.0.0.1\GSQL;UID=SA;PWD=ADMIN;DATABASE=WORKMOVE"; $conn->Open($connstr); ?> PHP+MYSQL PHP+SQLITE $db = @sqlite_open("sqlite.db"); 也可调用odbc方式连接sqlite 详见PHP手册 PHP+PostgreSQL $conn_string =@pg_connect("host=127.0.0.1 port=5432 dbname=test1 user=itnows password=000000") 关于MYSQL与SQLITE共同提取5151笔资料时间比较 次数 MYSQL SQLITE (单位,毫秒) 1 467.59 325.57 69.6% 2 509.15 333.10 65.4% 3 487.99 326.93 66.9% 4 511.35 352.47 68.9% 5 500.42 328.93 65.7% 补充: SQLite数据库在ASP下使用,先要装ODBC的驱动。才能set conn=server.createobject("adodb.connection")。 到这边下载sqlite的odbc驱动程序安装下就可以使用了
connstr="driver={sqlite3 odbc driver};database="&server.MapPath("data.db3")
|
|||
>> 相关文章 | |||
|