:
, Java- .
β’ sql
Import.java.sql.*;
β’
Every database has diffirent driver,we are using sql database so driver for sql database is
Class.forName( "com.mysql.jdbc.Driver" );
β’ Url
String url="jdbc:mysql://localhost/DataBaseName";
β’
Connection con=DriverManager(url,"root","");
β’ Statement
Statement st=con.CreateStatement();
After creating statement object,we can perform sql queries on database,
β’ Make a request
String sql="SELECT * FROM table_Name ";
β’ Request ResultSet Object and Excute
ResultSet rs=st.excuteUpdate(sql);
β’ An important step to close the connection
con.close();
Note , if we donβt have sql connector in jdk, the first boot connector from this url is
https://dev.mysql.com/downloads/connector/j/5.1.html
and copy and paste,
Java / JRE / Library / ext
source
share