<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>java data base connectivity Archives -</title>
	<atom:link href="https://mitindia.in/tag/java-data-base-connectivity/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/java-data-base-connectivity/</link>
	<description></description>
	<lastBuildDate>Sat, 09 Jul 2016 07:52:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>java data base connectivity Archives -</title>
	<link>https://mitindia.in/tag/java-data-base-connectivity/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>JDBC Examples</title>
		<link>https://mitindia.in/jdbc-examples/</link>
					<comments>https://mitindia.in/jdbc-examples/#comments</comments>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Thu, 30 Jun 2016 10:48:05 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java data base connectivity]]></category>
		<category><![CDATA[jdbc example]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=213</guid>

					<description><![CDATA[<p>JDBC or Java Data Base Connectivity – provides an interface to Relational Data Sources JDBC library provides the means for executing SQL statements to access and operate on a relational database JDBC library is implemented in the java.sql package Set of classes and interfaces that provide a uniform API for access to broad range of [&#8230;]</p>
<p>The post <a href="https://mitindia.in/jdbc-examples/">JDBC Examples</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>JDBC or Java Data Base Connectivity – provides an interface to Relational Data Sources<br />
JDBC library provides the means for executing SQL statements to access and operate on a relational database<br />
JDBC library is implemented in the java.sql package<br />
Set of classes and interfaces that provide a uniform API for access to broad range of databases.</p>
<div class="separator"><img fetchpriority="high" decoding="async" class="alignnone" src="http://4.bp.blogspot.com/-w8OvrhYIESM/VajNFG7dA3I/AAAAAAAAAZE/g1XtI-Hz0pw/s400/jdbc.JPG" width="400" height="252" border="0" /></div>
<div class="separator"></div>
<div class="separator"></div>
<div><i>JDBC’s design is very similar to the design of ODBC</i></div>
<div><b>•Driver Manager: Loads database drivers, and manages the connection between the application and the driver</b></div>
<div><b>•Driver: Translates API calls into operations for a specific data source</b></div>
<div><b>•Connection: A session between an application and a database</b></div>
<div><b>•Statement: </b><b>An SQL Statement to perform a query or update operation</b></div>
<div><b>•Metadata: </b><b>Information about returned data, the database and the driver</b></div>
<div><b>•ResultSet : </b><b>Logical set of columns and rows returned by executing an SQL statement </b></div>
<div></div>
<div class="separator"> <u><b><i>The following steps are executed when running a JDBC application</i></b></u></div>
<div class="separator">1. Import the necessary classes</div>
<div class="separator">2. Load the JDBC driver</div>
<div class="separator">3. Identify the database source</div>
<div class="separator">4. Allocate a “connection” object (create)</div>
<div class="separator">5. Allocate a “Statement” object (create)</div>
<div class="separator">6. Execute a query using the “Statement” object</div>
<div class="separator">7. Retrieve data from the returned “ResultSet” object</div>
<div class="separator">8. Close the “ResultSet” object</div>
<div class="separator">9. Close the “Statement” object</div>
<div class="separator">10. Close the “Connection” object</div>
<div class="separator"></div>
<div class="separator"><img decoding="async" class="alignnone" src="http://1.bp.blogspot.com/-uNIwu-cQGEI/VajOjj6iEpI/AAAAAAAAAZQ/M8XnrzhRwP8/s320/jdbc2.JPG" width="320" height="212" border="0" /></div>
<div class="separator"></div>
<div class="separator"></div>
<div class="separator">Java Database connectivity (jdbc) program to show list of records from sql server tables.</div>
<pre>import java.sql.*;
public class dbselect
{
 public static void main(String [] args) 
{
  Connection con = null;
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:jdtest");
      Statement sta = con.createStatement(); 

      ResultSet res = sta.executeQuery("SELECT * FROM emp");
      System.out.println("List of Records "); 
      
      while (res.next()) 
      {
         System.out.println("  "+res.getString("ecode") + ", "+res.getString("ename"));
      }
      res.close();
      sta.close();
      con.close();  
    } 
    catch (Exception e) {
        System.err.println("Exception: "+e.getMessage());
    }
  }
}</pre>
<div class="separator"></div>
<div class="separator">Java &#8211; JDBC Program to insert records into a table.</div>
<pre>import java.sql.*;
public class dbaccess2
{
 public static void main(String [] args) 
{
  Connection con = null;
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:jdtest");
      Statement sta = con.createStatement(); 

      int count = 0;
      int c = sta.executeUpdate("INSERT INTO sal"
        + " (basic, hra, net)" + " VALUES (4444, 44442, 3333)");
      count = count + c;
      System.out.println("Number of rows inserted: "+count);
      sta.close();
      con.close();        
    } 
    catch (Exception e) {
        System.err.println("Exception: "+e.getMessage());
    }
  }
}</pre>
<div class="separator"></div>
<div class="separator">Delete records from table using jdbc example</div>
<pre>import java.sql.*;
public class delaccess
{
 public static void main(String [] args) 
{
  Connection con = null;
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:test");
      Statement sta = con.createStatement(); 

      int count = 0;
      int c = sta.executeUpdate("DELETE from emp WHERE ename='rahul'");
      count = count + c;
 
      System.out.println("Number of rows DELETED: "+count);

      sta.close();
      con.close();        
    } 
    catch (Exception e) {
        System.err.println("Exception: "+e.getMessage());
    }
  }
}</pre>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fjdbc-examples%2F&amp;linkname=JDBC%20Examples" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fjdbc-examples%2F&amp;linkname=JDBC%20Examples" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fjdbc-examples%2F&#038;title=JDBC%20Examples" data-a2a-url="https://mitindia.in/jdbc-examples/" data-a2a-title="JDBC Examples"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/jdbc-examples/">JDBC Examples</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mitindia.in/jdbc-examples/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
