Terima Kasih Anda Telah mengunjungi Blog Ipin-Upin semoga bermanfaat

Selasa, 24 Mei 2011

Koneksi VB dengan Berbagai Database

Sobat sekalian , dibawah ini merupakan source code pada visual basic 6 untuk koneksi dengan database, sesuai dengan database yang anda gunakan. Semoga postingan ini berguna buat kalian yang sedang membutuhkan.

Access
Access ODBC Connection String Driver
{Microsoft Access Driver (*.mdb)};Dbq=C:\demo.mdb;Uid=Admin;Pwd=; '

Access OLEDB Connection String Driver
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\directory\demo.mdb;User Id=admin;Password=;

DB2
DB2 ODBC Connection String
driver={IBM DB2 ODBC DRIVER};Database=demodb;
hostname=myservername;port=myPortNum;protocol=TCPIP; uid=myusername; pwd=mypasswd

DB2 OLEDB Connection String
Provider=IBMDADB2;Database=demodeb;
HOSTNAME=myservername;PROTOCOL=TCPIP;PORT=50000;uid=myusername;pwd=mypasswd;

DBase DBase ODBC Connection String
Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\directory;

DBase OLEDB Connection String
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\directory;
Extended Properties=dBASE IV;User ID=Admin;Password=

Excel
Excel ODBC Connection String
Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=C:\MyExcel.xls;DefaultDir=c:\directory;

Excel OLEDB Connection String
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;
Extended Properties='"Excel 8.0;HDR=Yes;IMEX=1"'

Exchange
Exchange OLEDB Connection String
oConn.Provider = "EXOLEDB.DataSource" oConn.Open = "http://myServerName/myVirtualRootName"

Firebird
Firebird ODBC Connection String
DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=mypasswd;DBNAME=c:\directory\demo.fdb

Firebird OLEDB Connection String
User=SYSDBA;Password=mypasswd;Database=demo.fdb;DataSource=localhost;Port=3050;
Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;
MaxPoolSize=50;Packet Size=8192;ServerType=0

FoxPro
FoxPro ODBC Connection String
Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\demo.dbc;Exclusive=No;
NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO

FoxPro OLEDB Connection String
Provider=vfpoledb.1;Data Source=c:\directory\demo.dbc;Collating Sequence=machine

Informix
Informix ODBC Connection String
Driver={Informix-CLI 2.5 (32 Bit)};Server=demoservername;Database=demodb;
Uid=myusername;Pwd=mypasswd

Informix OLEDB Connection String
Provider=Ifxoledbc.2;User ID=myusername;password=mypasswd;
Data Source=demodb@demoservername;Persist Security Info=true

MySQL
MySQL ODBC Connection String
DRIVER={MySQL ODBC 3.51 Driver};SERVER=myservername;PORT=3306;
DATABASE=mydemodb; USER=myusername;PASSWORD=mypasswd;OPTION=3;

MySQL OLEDB Connection String
Provider=MySQLProv;Data Source=mydemodb;User Id=myusername;Password=mypasswd;

Oracle
Oracle ODBC Connection String
Driver={Microsoft ODBC for Oracle};Server=myservername;Uid=myusername;Pwd=mypassword;

Oracle OLEDB Connection String
Provider=msdaora;Data Source=mydemodb;User Id=myusername;Password=mypasswd;
Oracle .Net Connection String
Data Source=mydemodb;User Id=myusername;Password=mypasswd;Integrated Security=no;

SQL Server
SQL Server ODBC Connection String - Database Login
Driver={SQL Server};Server=myservername;Database=mydemodb;Uid=myusername;Pwd=mypasswd;

SQL Server ODBC Connection String - Trusted Connection
Driver={SQL Server};Server=mysername;Database=mydemodb;Trusted_Connection=yes;

SQL Server OLEDB Connection String - Database Login
Provider=sqloledb;Data Source=myservername;Initial Catalog=mydemodb;
User Id=myusername;Password=mypasswd;

SQL Server OLEDB Connection String - Trusted Connection
Provider=sqloledb;Data Source=myservername;Initial Catalog=mydemodb;Integrated Security=SSPI;

SQL Server .Net Connection String - Database Login
Server=myservername;Database=mydemodb;User ID=myusername;
Password=mypasswd;Trusted_Connection=False

SQL Server .Net Connection String - Trusted Connection
Server=myservername;Database=mydemodb;Integrated Security=SSPI;

Tidak ada komentar:

Posting Komentar