2010/05/11

VBA ADOconnectionString memo

Option Compare Database
Option Explicit

'Public Const cnString = ""


'********** MySQL **********
'Public Const cnString = "Driver={MySQL ODBC 5.1 Driver};" & _
                        "server=server_name;" & _
                        "port=3306;" & _
                        "database=DBName;" & _
                        "uid=Account_Name;" & _
                        "pwd=Password;" & _
                        "option=3;"

'Public Const cnString = "Driver={MySQL ODBC 3.51 Driver};" & _
                        "Server=myServerAddress;" & _
                        "Database=myDataBase;" & _
                        "User=myUsername;" & _
                        "Password=myPassword;" & _
                        "Option=3;"

'********** Access **********
'Public Const cnString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                        "Data Source=C:\myFolder\myAccessfile.accdb;" & _
                        "Persist Security Info=False;"

'Public Const cnString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                        "Data Source=C:\myFolder\myAccessfile.accdb;" & _
                        "Jet OLEDB:Database Password=MyDbPassword;"

'Public Const cnString = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};" & _
                        "DBQ=C:\myFolder\myAccessfile.accdb;"

'Public Const cnString = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};" & _
                        "DBQ=C:\myFolder\myAccessfile.accdb;" & _
                        "Pwd=MyDbPassword;" & _
                        "Uid="
'********** MS-SQL **********
'Public Const cnString = "Driver={SQL Server Native Client 10.0};" & _
                        "Server=myServerAddress;" & _
                        "Database=myDataBase;" & _
                        "Uid=myUsername;" & _
                        "Pwd=myPassword;"
'
'Are you using SQL Server 2008 Express?
'Don't miss the server name syntax Servername\SQLEXPRESS
'where you substitute Servername with the name of the
'computer where the SQL Server 2008 Express installation resides.
'
'Public Const cnString = "Driver={SQL Server Native Client 10.0};" & _
                        "Server=myServerAddress;" & _
                        "Database=myDataBase;" & _
                        "Trusted_Connection=yes;"
'
'Equivalent key-value pair: "Integrated Security=SSPI" equals "Trusted_Connection=yes"


0 件のコメント: