"jdbc code" Code Answer's

You're definitely familiar with the best coding language Java that developers use to develop their projects and they get all their queries like "jdbc code" answered properly. Developers are finding an appropriate answer about jdbc code related to the Java coding language. By visiting this online portal developers get answers concerning Java codes question like jdbc code. Enter your desired code related query in the search bar and get every piece of information about Java code related question on jdbc code. 

how to use jdbc

By Obedient OcelotObedient Ocelot on Jan 28, 2021
Connection = 
  Helps our java project connect to database
Statement = 
  Helps to write and execute SQL query
ResultSet = 
  A DataStructure where the data from query result stored
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    

  After succesfully created the connect
next step is 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

Statement statement = connection.
createStatement(ResultSet TYPE_SCROLL_INSENSITIVE
,ResultSet CONCUR_READ_ONLY);

-The result we get from this type of
statement can freely move between rows

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");

Add Comment

0

jdbc code

By Different DuckDifferent Duck on May 29, 2021
import java.sql.*;  
class MysqlCon{  
public static void main(String args[]){  
try{  
Class.forName("com.mysql.jdbc.Driver");  
Connection con=DriverManager.getConnection(  
"jdbc:mysql://localhost:3306/sonoo","root","root");  
//here sonoo is database name, root is username and password  
Statement stmt=con.createStatement();  
ResultSet rs=stmt.executeQuery("select * from emp");  
while(rs.next())  
System.out.println(rs.getInt(1)+"  "+rs.getString(2)+"  "+rs.getString(3));  
con.close();  
}catch(Exception e){ System.out.println(e);}  
}  
}  

Add Comment

0

jdbc code

By Different DuckDifferent Duck on May 29, 2021
create database sonoo;  
use sonoo;  
create table emp(id int(10),name varchar(40),age int(3));  

Add Comment

0

All those coders who are working on the Java based application and are stuck on jdbc code can get a collection of related answers to their query. Programmers need to enter their query on jdbc code related to Java code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about jdbc code for the programmers working on Java code while coding their module. Coders are also allowed to rectify already present answers of jdbc code while working on the Java language code. Developers can add up suggestions if they deem fit any other answer relating to "jdbc code". Visit this developer's friendly online web community, CodeProZone, and get your queries like jdbc code resolved professionally and stay updated to the latest Java updates. 

Java answers related to "jdbc code"

View All Java queries

Java queries related to "jdbc code"

Browse Other Code Languages

CodeProZone