Archive

Posts Tagged ‘SQL’

Database Connections in PHP

October 1st, 2009 Mehmatrix 1 comment


1.1) MYSQL Connection in PHP

We can use mysql_connect and mysql_select_db functions to create our connections. For closing the connections there is mysql_close function. These are basic functions of managing connections in PHP. There are also a lot of classes made by developers for free.

Sturcture 1.0:

1
2
3
4
5
<?php
$ConnectionName = mysql_connect('MyHost', 'MyLogin', 'MyPassword');
$DatabaseConnection = mysql_select_db('MyDatabaseName', $ConnectionName);
mysql_close($ConnectionName);
?>

You can determine the MyHost, MyLogin, MyPassword and MyDatabaseName variables as you need.

Example 1.0: We used hostname:port syntax Click to Read Complete Article »

Bookmark and Share

Database Connections in ASP

September 24th, 2009 Mehmatrix No comments


1.1) MSSQL ( Microsoft SQL Server ) Connection in ASP


Sturcture 1.1:

1
2
3
4
< %
Set ConnectionName=Server.CreateObject("Adodb.Connection")
ConnectionName.Open "driver={SQL Server};server=MyHost;uid=MyLogin;pwd=MyPassword;database=MyDatabaseName"
%>

You can determine the server, uid, pwd and database variables as you need.

Example 1.1:

1
2
3
4
< %
Set MyConn=Server.CreateObject("Adodb.Connection")
MyConn.Open "driver={SQL Server};server=127.0.0.1;uid=memisologin;pwd=memiso;database=memisodb"
%>

1.2) MDB ( Microsoft Access Database ) Connection in ASP

Click to Read Complete Article »

Bookmark and Share

Database Connections in Java

September 24th, 2009 Mehmatrix No comments

Before giving structures, we need to notice a little detail about making database connections in Java. All database connections must be stated in try and catch statements, because there is a possibility of getting an exception. That’s way, we try to make our connection in try statement. If our connection attempt fails, that means there is an exception, and the exceptions must be catched.

1.1) MS SQL Connection in Java

Example 1.1: MakingConnections.java Click to Read Complete Article »

Bookmark and Share
eXTReMe Tracker