Database Connection

[Solved] Database Connection | Abap - Code Explorer | yomemimo.com
Question : database connection

Answered by : hasitha-sandeepa-fgnwm5c9acxi

<?php
$serverName = "localhost";
$userName = "root";
$password = "";
$database = "mydb"; //database name
//Check connection
$conn = new mysqli($serverName, $userName, $password, $database);
if ($conn->connect_error) { die("Connection Failed - " . $conn->connect_error);
} else { echo "connected";
}
?>

Source : | Last Update : Sun, 16 Oct 22

Question : how do you connect the database

Answered by : obedient-ocelot-5tkogtygmlyl

I USE JDCB
I use CONNECTION database to make connection
I create STATEMENT than I use statement to create query
And run the query and get the RESULT SET
Connection = import java.sql.Connection;
Driver manager = import java.sql.DriverManager;
Connection connection = DriverManager.getConnection(url, userName, passWord);
Connection String Syntax:
jdbc:DataBaseType"subprotocal:Host:port:SID
After succesfully created the connect next step is STATEMENT
import java.sql.Statement;
Statement statement = connection.createStatement();
-We use createStatement() method to create the statement from our connection.
-The result we get from this type of statement can only move from top to bottom,
not other way around
Once we have statement we can run the query and get the result to
ResultSet format	import java.sql.ResultSet;
We use the method executeQuery() to execute our queries
ResultSet result = statement.executeQuery("Select * from employees");

Source : | Last Update : Sat, 05 Dec 20

Answers related to database connection

Code Explorer Popular Question For Abap