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



Home Answers Viewqa Ajax CHN15M116
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


javacoder
CHN15M116
0 Answer(s)      2 years and 11 months ago
Posted in : Ajax


package ExamplePackage;

import java.sql.*; import java.util.*;

public class ConnectionManager {

  static Connection con;
  static String url;

  public static Connection getConnection()
  {

     try
     {

        Class.forName("oracle.jdbc.driver.OracleDriver");
        System.out.println(" Defing the URL");

         String url= "jdbc:oracle:thin:@172.24.137.30:1521:ORA10G";
        // assuming "DataSource" is your DataSource name

       // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

        try
        {   


            System.out.println(" Defing the username");
            String username= "e469573"; 
            System.out.println(" Defing the password");
            String password= "nkDquOhwj";
            System.out.println(" Defing the connection");
            con = DriverManager.getConnection(url,username,password); 
            System.out.println(" connection done" +con);





        }

        catch (SQLException ex)
        {
           ex.printStackTrace();
        }
     }

     catch(ClassNotFoundException e)
     {
        System.out.println(e);
     }

  return con;

} }


Advertisement
View Answers

Related Tutorials/Questions & Answers:
CHN15M116
CHN15M116  package ExamplePackage; import java.sql.*; import java.util.*; public class ConnectionManager { static Connection con; static String url; public static Connection getConnection() { try
Advertisements
 

 

 

DMCA.com