Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

java.sql package interfaces

Ads

 
 

Share on Google+Share on Google+

Nagarjuna
java.sql package interfaces
2 Answer(s)      5 years and 2 months ago
Posted in : JDBC

In java.sql package majority are interfaces only, how instance will be created for these interfaces?

Ads
View Answers

January 16, 2013 at 5:34 PM


Hi, in jdbc we are using some jar files like for oracle ds we are using ojdbc14.jar. These jar files contain the classes which provides the implemtation to java.sql interfaces. For example the ojdbc14.jar file contain the class like OracleDatabaseMetaData class which provide the implemtation to java.sql.DatabaseMetaData interface. Hence

connection.getMetaData() contain the code to creat the object to OracleDatabaseMetaData.



May 25, 2012 at 2:26 PM


In java.sql package, there are several interfaces. These interfaces have been used in connection database with the java code.

import java.sql.*;

public class MysqlConnect{
  public static void main(String[] args) {
  System.out.println("MySQL Connect Example.");
  try {
  Class.forName("com.mysql.jdbc.Driver").newInstance();
  Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
  System.out.println("Connected to the database");
  conn.close();
  System.out.println("Disconnected from database");
  } catch (Exception e) {
  e.printStackTrace();
  }
 }
}

Ads









Related Tutorials/Questions & Answers:
Introduction to java.sql package
Introduction to java.sql package       This package provides the APIs for accessing... especially relational databases. This java.sql package contains API
interfaces
& interfaces.   An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods... to directly implement one or more interfaces, meaning that any instance of the class
Advertisements
java.Sql - JDBC
java.Sql  Hai Friend, In my program i have sql statement like below: while(true) { sqlstmt="SELECT * FROM tablename"; rs=stmt.executeQuery(sqlstmt); while(rs.next()) { System.out.print("\n
Package
Package  Create a Package named com.example.code. Write few classes, interface and abstract classes. Now create a class names PackageDemo that uses the classes of this package from other package
Package
Package  Create a Package named com.example.code. Write few classes, interface and abstract classes. Now create a class names PackageDemo that uses the classes of this package from other package
package:
package:  i hv created created a package and save it into D... in a package world. The we specify the keyword package with the name of the package. package world; public class HelloWorld { public static void main(String
package:
package:  i hv created created a package and save it into D... in a package world. The we specify the keyword package with the name of the package. package world; public class HelloWorld { public static void main(String
package
package  by what name we can save a java file that contain a package {i.e package p;} and several public classes {i.e public class abc} but not a main method
package
package  hello, What is a package?   hello, To group set of classes into a single unit is known as packaging. Packages provides wide namespace ability
package
can allow types in one package to have unrestricted access to one another, still restricting the access for the types outside the package
package
package  write a package for games which have two classes indoor... specifier and also use the finalize() method   We have created a package... class, we have imported this package and using a function display(), we have
package
package  Smith has created a package named ApplianceDetails that contains the Appliance class.Now he wants to create a class named NewAppliance that stores the details of the newly launched appliances.He uses the following syntax
package
package  Smith has created a package named ApplianceDetails that contains the Appliance class.Now he wants to create a class named NewAppliance that stores the details of the newly launched appliances.He uses the following syntax
EJB Interfaces
EJB Interfaces       Interface... interfaces. These are as follows 1)Remote interface:- Remote interface.... This is the interface where all of the business method go.javax.ejb.Remote package is used
What is a package?
programming language, A package is group of related types of classes & interfaces...What is a package?  hi, What is a package? thanks   Hi, The Package is a mechanism for organizing the group of related files
Interfaces in flex
Interfaces in flex  Hi..... Please tell me about... What are - IStyleClient, IChildList, ILayoutManager, IToolTipManagerClient, IInvalidating, IValidatorListener, IFlexModule, IAutomationObject, IPropertyChangeNotifier
Package categories in Java
interfaces and classes.  Package Name... Package categories in Java     ... hierarchy structure shown above. Note that, the package "java" also has
Marker interfaces in java
Marker interfaces in java  how marker interfaces work
What are Callback interfaces?
What are Callback interfaces?  Hi, What are Callback interfaces? thanks
EJB Interfaces
EJB Interfaces       Interface... interfaces. These are as follows 1)Remote interface:- Remote interface.... This is the interface where all of the business method go.javax.ejb.Remote package is used
Hibernate Callback interfaces
Hibernate Callback interfaces  What are Callback interfaces?   Callback interfaces allow the application to receive a notification when something interesting happens to an object?for example, when an object is loaded
Interfaces - Java Interview Questions
Interfaces  two interfaces having same method names and these two interfaces are implemented by a single class. so now i would like to generate different code of same methods of different interfaces. eg: ---- interface i1
package creation
package creation  program to create package having four different class in java
package in java
package in java  when i run a package it give a error exception in thread "main" java.lang.NoClassDefFoundError what i do
Collection Interfaces
Collection Interfaces     ... of several interfaces, and classes that implement those interfaces, contained within the java.util package. It provides tools for maintaining a data container
regarding java package - Java Beginners
regarding java package  can you provide tutorial for java.sql package please help  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net
Java package
Java package  Which package is always imported by default
Package in Applet
Package in Applet  How do I use this technique for applets
Interfaces - Java Interview Questions
Interfaces  two interfaces having same method names and these two interfaces are implemented by a single class. so now i would like to generate different code of same methods of different interfaces in single class? my query
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
java interfaces implementation
java interfaces implementation  hai I have defined one inter face like Maths taking methods like add(), sub(), mul()in interface I take different implementation classes for add() method and sub()and mul() when i trying