Nge-Blog ala Kang Yunan

Icon

Kehidupan, IT, Teknologi Informasi, Gosip, Film, Artis, Budi Anduk, Sosial, Komunitas, Pemerintahan, Rumah Tangga, Masyarakat, Kuliner, Makanan, New Idea, Sport, Olahraga, Liputan, Ulasan, Renungan, Agama, Islam

ODBC Connection with PHP

ODBC (Open Database Connectivity) is group of database driver which have been registered in the Windows. Sometimes when you install DBMS (ex : Microsoft Access, etc) installer include driver for ODBC. If you want to show what driver has been installed on you computer, you can Click Start->Run, please type : ODBCAD32 on textbox.

odbcad32.jpg

112.jpg

After that it will show a window, please open tab “Drivers”. So you can create connectivity based on list. ODBC can reduce requirement of function each database, because in PHP each database can have difference function.

CREATE Connection Class

Connection string maybe same with connection string on windows programming. Driver={SQL Server};Server=”.$ser.”;Database=”.$db,$user,$pass. Function odbc_connect for create connection with database. So we don’t scare if you will develop program with PHP and non mySQL.

class {

    function create_connection() {

        $ser=”LOCALMACHINE”; #the name of the SQL Server
$db=”mydatabase”; #the name of the database
$user=”myusername”; #a valid username
$pass=”my pass”; #a password for the username# one line
$conn=odbc_connect(“Driver={SQL Server};Server=”.$ser.”;Database=”.$db,$user,$pass);

Filed under: Database, Internet, Programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: