connection string untuk ado
Saat kita membuat aplikasi, adakalanya kita terbentur dengan pilihan database, apakah harus menggunakan dbms lisense atau free dbms. Jika project yang kita tangani budgetnya besar tidak masalah jika kita menggunakan DBMS sekelas MS-SQL, Oracle atau mungkin DBnya IBM, tetapi ketika dana adalah sebuah kendala maka salah satu solusi untuk memangkas biaya yakni menggunakan DBMS gratisan seperti mySQL, FireBird atau free dbms lainnya.
Bagi pengguna ADO/ ADO.NET untuk melakukan koneksi keberbagai DBMS alternatif sering terbentur pada provider conectionnya, atau mungkin juga tidak mengetahui connection string yang tepat untuk berbagai DBMS alternatif tersebut.
Misalnya pilihan jatuh kepada mySQL, maka ada beberapa metode connection string yang bisa dipilih antara lain :
mySQL with ODBC
strConnect = _T("Driver={mySQL ODBC 3.51 Driver};" & _
"Server=MyRemoteHost;" & _
"Port=3306;Option=4;Database=MyDatabase;" & _
"Uid=MyUsername;Pwd=MyPassword;");
Dimana option ini antara lain :
- 1 - The client can’t handle that MyODBC returns the real width of a column.
- 2 - The client can’t handle that MySQL returns the true value of affected rows. If this flag is set then MySQL returns ‘found rows’ instead. One must have MySQL 3.21.14 or newer to get this to work.
- 4 - Make a debug log in c:\myodbc.log. This is the same as putting MYSQL_DEBUG=d:t:O,c::\myodbc.log in AUTOEXEC.BAT.
- 8 - Don’t set any packet limit for results and parameters.
- 16 - Don’t prompt for questions even if driver would like to prompt.
- 32 - Enable or disable the dynamic cursor support. This is not allowed in MyODBC 2.50.
- 64 - Ignore use of database name in ‘database.table.column’.
- 128 - Force use of ODBC manager cursors (experimental).
- 256 - Disable the use of extended fetch (experimental).
- 512 - Pad CHAR fields to full column length.
- 1024 - SQLDescribeCol() will return fully qualified column names.
- 2048 - Use the compressed server/client protocol.
- 4096 - Tell server to ignore space after function name and before ‘(’ (needed by PowerBuilder). This will make all function names keywords!
- 8192 - Connect with named pipes to a MySQLd server running on NT.
- 16384 - Change LONGLONG columns to INT columns (some applications can’t handle LONGLONG).
- 32768 - Return ‘user’ as Table_qualifier and Table_owner from SQLTables (experimental).
- 65536 - Read parameters from the client and ODBC groups from my.cnf.
- 131072 - Add some extra safety checks (should not be needed but…).
Jika anda menggunakan OLEDB maka connection string untuk mySQL seperti dibawah ini :
strConnection = _T("Provider=MySQLProv;" & _
"Server=localhost;" & _
"Database=MyDatabase;" & _
"User=MyUserName;" & _
"Password=MyPassword")
Untuk ODBC download file myodbc.x.x ( x versi driver ) dan OLEDB download driver mySQLprovider.





stmikbg.com adalah web untuk komunitas bagi anak-anak stmik bumigora khususnya dan anak-anak IT umumnya, baek yang cupu maupun yang expert.