Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC java.sql package interfaces
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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


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


Advertisement
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();
  }
 }
}


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
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
Advertisements
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
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
Interfaces in flex
Interfaces in flex  Hi..... Please tell me about... What are - IStyleClient, IChildList, ILayoutManager, IToolTipManagerClient, IInvalidating, IValidatorListener, IFlexModule, IAutomationObject, IPropertyChangeNotifier
What are Callback interfaces?
What are Callback interfaces?  Hi, What are Callback interfaces? thanks
Marker interfaces in java
Marker interfaces in java  how marker interfaces work
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
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 categories in Java
interfaces and classes.  Package Name... Package categories in Java     ... hierarchy structure shown above. Note that, the package "java" also has
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
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
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
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
interfaces - Java Beginners
interfaces  What is the mechanism going behind when an interface extends another interface?in case of classes when a sub class extends super class, super class constructor runs.what about interfaces?  Hi Friend
interfaces,exceptions,threads
interfaces,exceptions,threads  SIR,IAM JAVA BEGINER,I WANT KNOW THE COMPLETE CONEPTS OF INTERFACES,EXCEPTIONS,THREADS   Interface An interface is one which has abstract methods(not defined just declared)and static
What are the Core interfaces are of Hibernate framework?
What are the Core interfaces are of Hibernate framework?  Hi, What are the Core interfaces are of Hibernate framework? Thanks
Hibernate: core interfaces of hibernate framework
Hibernate: core interfaces of hibernate framework  What are the core interfaces of hibernate framework   Most of hibernate based application code deals with following interfaces provided by the Hibernate Core
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
Advertisements
 

 

 

DMCA.com