Results 1 to 3 of 3
  1. #1
    krishm is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default connecttion management

    package com.tcs.nsep.beta.dao;

    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;

    public class Connectionmanager {
    static Connection conn;
    static String url;

    public static Connection getConnection() {

    String serverName = "172.24.137.30";
    String portNumber = "1521";
    String sid = "ora10G";

    String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":"
    + sid;
    String username = "";
    String password = "";

    try {

    // load the JDBC-ODBC Bridge driver
    Class.forName("oracle.jdbc.driver.OracleDriver");

    // connect to db using DriverManager
    // System.out.println("The Jdbc URL is " + url);
    conn = DriverManager.getConnection(url, username, password);

    return conn;
    }

    catch (ClassNotFoundException cnfex) {
    // System.out.println("Class not found !! " + cnfex);
    } catch (SQLException sqlex) {
    // System.out.println("SQL Exception !! " + sqlex);
    sqlex.printStackTrace();
    } catch (Exception ex) {
    // System.out.println("Exception has occured " + ex);
    } finally {

    }

    return conn;
    }
    }

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: connecttion management

    And what was your question? :)

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: connecttion management

    Another one?
    That's three or four I've seen since yesterday morning where there's just code posted.

Similar Threads

  1. File management API
    By viiids in forum New To Java
    Replies: 2
    Last Post: 12-25-2010, 12:40 AM
  2. password management
    By Stephen Douglas in forum New To Java
    Replies: 6
    Last Post: 07-23-2010, 11:17 AM
  3. session management
    By rakesh_n_mehta in forum Web Frameworks
    Replies: 7
    Last Post: 09-22-2009, 07:02 PM
  4. Need Suggestions on layout management
    By rdtindsm in forum AWT / Swing
    Replies: 2
    Last Post: 04-26-2009, 06:14 AM
  5. library management
    By jyothi.priyanka in forum New To Java
    Replies: 25
    Last Post: 03-11-2009, 05:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •