1I USE JDCB
2I use CONNECTION database to make connection
3I create STATEMENT than I use statement to create query
4And run the query and get the RESULT SET
5
6
7Connection = import java.sql.Connection;
8Driver manager = import java.sql.DriverManager;
9Connection connection = DriverManager.getConnection(url, userName, passWord);
10
11Connection String Syntax:
12jdbc:DataBaseType"subprotocal:Host:port:SID
13
14After succesfully created the connect next step is STATEMENT
15
16import java.sql.Statement;
17Statement statement = connection.createStatement();
18
19-We use createStatement() method to create the statement from our connection.
20-The result we get from this type of statement can only move from top to bottom,
21not other way around
22
23Once we have statement we can run the query and get the result to
24ResultSet format
25 import java.sql.ResultSet;
26
27We use the method executeQuery() to execute our queries
28
29ResultSet result = statement.executeQuery("Select * from employees");
1<?php
2$servername = "localhost";
3$username = "yourusername"; // For MYSQL the predifined username is root
4$password = "yourpassword"; // For MYSQL the predifined password is " "(blank)
5
6// Create connection
7$conn = new mysqli($servername, $username, $password);
8
9
10// Check connection
11
12 if ($conn->connect_error) {
13
14 die("Connection failed: " . $conn->connect_error);
15}
16
17echo "Connected successfully";
18
19?>