CISA FotoGallery

Statistiche

Tot. visite contenuti : 928232
Home Articoli tecnici Tabelle Stringhe di Connessione per Database

Stringhe di Connessione per Database

STRINGHE DI CONNESSIONE AI DATABASE PIU' CONOSCIUTI CONNECT TO MYSQL To connect to a local database (using MyODBC Driver) oConn.Open "Driver={mySQL};" & _ "Server=MyServerName;" & _ "Option=16834;" & _ "Database=mydb" '----------------------------------------------------------------------- To connect to a remote database oConn.Open "Driver={mySQL};" & _ "Server=db1.database.com;" & _ "Port=3306;" & _ "Option=131072;" & _ "Stmt=;" & _ "Database=mydb;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" '----------------------------------------------------------------------- To connect to a local database (using MySQL ODBC 3.51 Driver) oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _ "Server=myServerName;" & _ "Port=3306;" & _ "Option=16384;" & _ "Stmt=;" & _ "Database=mydatabaseName;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" Or oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};" & _ "SERVER=myServerName;" & _ "DATABASE=myDatabaseName;" & _ "USER=myUsername;" & _ "PASSWORD=myPassword;" '*********************************************************************** CONNECT TO EXCEL oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _ "DriverId=790;" & _ "Dbq=c:\somepath\mySpreadsheet.xls;" & _ "DefaultDir=c:\somepath" '*********************************************************************** CONNECT TO INTERBASE ODBC Driver for Interbase - from Easysoft For the local machine oConn.Open "Driver={Easysoft IB6 ODBC};" & _ "Server=localhost;" & _ "Database=localhost:C:\Home\Data\Mydb.gdb;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" For a remote machine oConn.Open "Driver={Easysoft IB6 ODBC};" & _ "Server=myMachineName;" & _ "Database=myMachineName:C:\Home\Data\Mydb.gdb;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" '----------------------------------------------------------------------- ODBC Driver for Interbase - from InterSolv For the local machine oConn.Open "Driver={INTERSOLV InterBase ODBC Driver (*.gdb)};" & _ "Server=localhost;" & _ "Database=localhost:C:\Home\Data\Mydb.gdb;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" For a remote machine oConn.Open "Driver={INTERSOLV InterBase ODBC Driver (*.gdb)};" & _ "Server=myMachineName;" & _ "Database=myMachineName:C:\Home\Data\Mydb.gdb;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" '*********************************************************************** CONNECT TO SQL_SERVER ODBC Driver for SQL Server For Standard Security oConn.Open "Driver={SQL Server};" & _ "Server=MyServerName;" & _ "Database=myDatabaseName;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" '----------------------------------------------------------------------- For Trusted Connection security oConn.Open "Driver={SQL Server};" & _ "Server=MyServerName;" & _ "Database=myDatabaseName;" & _ "Uid=;" & _ "Pwd=" ' Or oConn.Open "Driver={SQL Server};" & _ "Server=MyServerName;" & _ "Database=myDatabaseName;" & _ "Trusted_Connection=yes" '----------------------------------------------------------------------- To Prompt user for username and password oConn.Properties("Prompt") = adPromptAlways oConn.Open "Driver={SQL Server};" & _ "Server=MyServerName;" & _ "DataBase=myDatabaseName" '----------------------------------------------------------------------- To connect to SQL Server running on the same computer oConn.Open "Driver={SQL Server};" & _ "Server=(local);" & _ "Database=myDatabaseName;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" '----------------------------------------------------------------------- To connect to SQL Server running on a remote computer (via an IP address) oConn.Open "Driver={SQL Server};" & _ "Server=xxx.xxx.xxx.xxx;" & _ "Address=xxx.xxx.xxx.xxx,1433;" & _ "Network=DBMSSOCN;" & _ "Database=myDatabaseName;" & _ "Uid=myUsername;" & _ "Pwd=myPassword" Where: - xxx.xxx.xxx.xxx is an IP address - 1433 is the default port number for SQL Server. - "Network=DBMSSOCN" tells ODBC to use TCP/IP rather than Named Pipes (Q238949) '----------------------------------------------------------------------- '*********************************************************************** CONNECT TO AS/400 ODBC Driver for AS/400 (from IBM) oConn.Open "Driver={Client Access ODBC Driver (32-bit)};" & _ "System=myAS400;" & _ "Uid=myUsername;" & _ "Pwd=myPassword"