没有合适的资源?快使用搜索试试~ 我知道了~
数据库连接字符串代码大全(收藏)
4星 · 超过85%的资源 需积分: 10 16 下载量 69 浏览量
2012-03-05
16:20:36
上传
评论
收藏 159KB DOC 举报
温馨提示
试读
26页
收藏了各种情况下的数据库连接字符串。主要为.NET和各种主流数据库管理软件(SQL Server\ACCESS\MySQL\Oracle\...)等,也包括了各种连接方式,比如OledbConnection或者SqlConnection,也罗列了数据库管理软件的版本不同情况问题。 特别强大的收藏!!初学者和IT人士都不该错过的大全!!非常方便实用!
资源推荐
资源详情
资源评论
数据库连接字符串大全(收藏)
兰杉 hp://www.knowsky.com/339545.html 2012-3-1
转自:http://www.connectionstrings.com/
SQL Server
ODBC
o Standard Security:
"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"
o Trusted connection:
"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
o PRompt for username and passWord:
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=Aron1;DataBase=pubs;"
OLE DB, OleDbConnection (.NET)
o Standard Security:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
o Trusted Connection:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
o Prompt for username and password:
oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Data Source=Aron1;Initial Catalog=pubs;"
o Connect via anipaddress:
"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial
Catalog=pubs;User ID=sa;Password=asdasd;"
!"#!$%&$'('$)'())
*+,,)'(
SqlConnection (.NET)
o Standard Security:
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
---.--.
"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
---/)0')
o Trusted Connection:
"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
---.--.
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
---/)0')
o Connect via an IP address:
"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User
ID=sa;Password=asdasd;"
!"#!$%&$'('$)'())
*+,,)'(
o Declare the SqlConnection:
!12
0334!5
4!!"64!5
!3!0"7075
!3 5
839#2
&334!
!:4!"64!
!3!0"707
!3 -
Data Shape
o MS Data Shape
"Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=Aron1;Initial
Catalog=pubs;User ID=sa;Password=asdasd;"
;')0<!)+=(>?@-0/)0
AA
Read more
o How to de>ne which network protocol to use
Example:
"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial
Catalog=pubs;User ID=sa;Password=asdasd;"
Name Network library
dbnmpntw Win32 Named Pipes
dbmssocn Win32 Winsock TCP/IP
dbmsspxn Win32 SPX/IPX
dbmsvinn Win32 Banyan Vines
dbmsrpcn
Win32 Multi-Protocol (Windows
RPC)
Important note!
When connecting through the SQLOLEDB provider use the syntax6
/"'/
and when connecting through MSDASQL provider use the syntax6"'/
o All SqlConnection connection string properties
This table shows all connection string properties for the ADO.NET SqlConnection object. Most of
the properties are also used in ADO. All properties and descriptions is from msdn.
Name Default Description
applicationName The name of the application, or '.Net SqlClient Data
Provider' if no application name is provided.
AttachDBFilename
-or-
extendedpropertie
s
The name of the primary >le, including the full path
name, of an attachable database. The database
name must be speci>ed with the keyword
'database'.
-or-
Initial File Name
Connect Timeout
-or-
Connection
Timeout
15 The length of time (in seconds) to wait for a
connection to the server before terminating the
attempt and generating an error.
Connection Lifetime 0 When a connection is returned to the pool, its
creation time is compared with the current time,
and the connection is destroyed if that time span
(in seconds) exceeds the value speci>ed by
connection lifetime. Useful in clustered
con>gurations to force load balancing between a
running server and a server just brought on-line.
Connection Reset 'true' Determines whether the database connection is
reset when being removed from the pool. Setting
to 'false' avoids making an additional server round-
trip when obtaining a connection, but the
programmer must be aware that the connection
state is not being reset.
Current Language The SQL Server Language record name.
Data Source
-or-
Server
-or-
Address
-or-
Addr
-or-
Network Address
The name or network address of the instance of
SQL Server to which to connect.
Enlist 'true' When true, the pooler automatically enlists the
connection in the creation thread's current
transaction context.
Initial Catalog
-or-
Database
The name of the database.
Integrated Security
-or-
Trusted_Connection
'false' Whether the connection is to be a secure
connection or not. Recognized values are 'true',
'false', and 'sspi', which is equivalent to 'true'.
Max Pool Size 100 The maximum number of connections allowed in
the pool.
Min Pool Size 0 The minimum number of connections allowed in
the pool.
Network Library
-or-
Net
'dbmssocn' The network library used to establish a connection
to an instance of SQL Server. Supported values
include dbnmpntw (Named Pipes), dbmsrpcn
(Multiprotocol), dbmsadsn (Apple Talk), dbmsgnet
(VIA), dbmsipcn (Shared Memory) and dbmsspxn
(IPX/SPX), and dbmssocn (TCP/IP).
The corresponding network DLL must be installed
on the system to which you connect. If you do not
specify a network and you use a local server (for
example, "." or "(local)"), shared memory is used.
Packet Size 8192 Size in bytes of the network packets used to
communicate with an instance of SQL Server.
Password
-or-
Pwd
The password for the SQL Server account logging
on.
Persist Security Info 'false' When set to 'false', security-sensitive information,
such as the password, is not returned as part of the
connection if the connection is open or has ever
been in an open state. Resetting the connection
string resets all connection string values including
the password.
Pooling 'true' When true, the SQLConnection object is drawn
from the appropriate pool, or if necessary, is
created and added to the appropriate pool.
User ID The SQL Server login account.
Workstation ID the local
computer
name
The name of the workstation connecting to SQL
Server.
Note
Use ; to separate each property.
If a name occurs more than once, the value from the last one in the connection string
will be used.
If you are building your connection string in your app using values from user input
>elds, make sure the user can't change the connection string by inserting an
additional property with another value within the user value.
SQL Server 2005
SQL Native Client ODBC Driver
o Standard security:
"Driver={SQL Native Client};Server=Aron1;Database=pubs;UID=sa;PWD=asdasd;"
剩余25页未读,继续阅读
资源评论
- tianya99092014-05-08很不错。对于不熟悉的人可以看看
LanShan69
- 粉丝: 7
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Win64OpenSSL-3-3-0.exe
- 课高分程设计-基于C++实现的民航飞行与地图简易管理系统-南京航空航天大学
- 航天器遥测数据故障检测系统python源码+文档说明+数据库(课程设计)
- 北京航空航天大学操作系统课设+ppt+实验报告
- 基于Vue+Echarts实现风力发电机中传感器的数据展示监控可视化系统+源代码+文档说明(高分课程设计)
- 基于单片机的风力发电机转速控制源码
- 基于C++实现的风力发电气动平衡监测系统+源代码+测量数据(高分课程设计)
- 毕业设计- 基于STM32F103C8T6 单片机,物联网技术的太阳能发电装置+源代码+文档说明+架构图+界面截图
- 基于 LSTM(长短期记忆)(即改进的循环神经网络)预测风力发电厂中风力涡轮机产生的功率+源代码+文档说明
- 基于stm32f103+空心杯电机+oled按键+运动算法
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功