Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Connect to the Oracle Database Help class     - [SHELL] MySQL primary recovery solution from + Keepalived online (Server)

- Django url () function Detailed (Programming)

- Recover Ubuntu 14.04 wakes up from standby in case mouse keyboard appears dead (Linux)

- Git use and interpretation of common commands (Linux)

- VirtualBox CentOS is configured as a local disk mirroring software source (Linux)

- CentOS 6.5 / 6.6 modify the default SSH port number (Linux)

- Jetty JNDI Development combat (Linux)

- curl Usage: Being the first site header and status codes (Server)

- Intrusion prevention network server security maintenance tips (Linux)

- Install Firefox 28 on Ubuntu, Linux Mint (Linux)

- Git Getting Started tutorial (Linux)

- CentOS 6 Install Linux kernel source (Linux)

- When Linux Detailed time zone and common function of time (Linux)

- Win8 mount disk partitions under Ubuntu (Linux)

- Install Java on RHEL6 (Linux)

- Java Concurrency - processes and threads (Programming)

- Usage of sudo (Linux)

- Rails project prepared some tips small experience (Linux)

- TNS-03505 name could not be resolved (Database)

- Linux (SUSE) mount NTFS mobile hard practice (Linux)

 
         
  Connect to the Oracle Database Help class
     
  Add Date : 2017-08-31      
         
         
         
  Connect Oracle Database Help class, is to connect the Oracle database method encapsulation, you only need to call in other pages, do not need to repeat the write.

Import java.sql.Connection;
Import java.sql.DriverManager;
Import java.sql.SQLException;

Import oracle.jdbc.driver.OracleDriver;

/ **
 * Database connection help class
 *
 * /
Public class DbHelp {

    / *
    * Database connection
    * /
    Public static Connection lianjie () {
        
        // Database configuration
        String driver = "oracle.jdbc.driver.OracleDriver"; // driver
        String url = "jdbc: oracle: thin: @localhost: 1521: JBITDB";
        String user = "epet";
        String pwd = "123456";
        
        Try {
            // Step 1: Load the driver
            Class.forName (driver); // -> Reflection
            
            Connection conn = DriverManager.getConnection (url, user, pwd);
            
            Return conn;
            
        } Catch (ClassNotFoundException e) {
            E.printStackTrace ();
        } Catch (SQLException e) {
            E.printStackTrace ();
        }}
          Return null;
 }}
}}
     
         
         
         
  More:      
 
- Fedora 21 setting boot script (Linux)
- OpenStack Folsom create an instance of the failure of the Quota Fixed_IP articles (Server)
- Oracle Listener can not start (TNS-12555, TNS-12560, TNS-00525) (Database)
- Docker: Mirroring and container operations (Server)
- Vim configuration instructions (Linux)
- 5 fast Node.js application performance tips (Programming)
- Vim plugin installation YouCompleteMe (Linux)
- Node.js simple interface server (Server)
- Linux run queue process scheduling (Programming)
- Oracle VirtualBox Problem Solving Case (Linux)
- Linux file permissions to modify the command: chmod (Linux)
- VirtualBox modify the size of the virtual machine disk VDI (Linux)
- Oracle 11G using DG Broker create DataGuard (Database)
- Necessity in Java packages (Programming)
- Create a project using Android Studio LinearLayout (Programming)
- MariaDB 10.0.X, the dynamic column support JSON format to obtain data (Database)
- APF firewall installation and configuration under Linux (Linux)
- CentOS 6 kernel upgrade to Kernel 3.x (Linux)
- Oracle 10g, 11g database silent installation of small differences (Database)
- Docker Basic Concepts (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.