Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Connect to the Oracle Database Help class     - SecureCRT use the configuration detailed tutorial (Linux)

- How MAT Android application memory leak analysis (Programming)

- iOS used in the development --UITabBarController tag controller (Programming)

- Linux System Getting Started Tutorial: permission to permanently modify the USB device in Linux (Linux)

- The relationship between UNIX and Linux (Linux)

- How to Install lightweight Budgie desktop on Ubuntu 14.04 (v8) (Linux)

- I use the desktop environment in GNU / Linux combination tool (Linux)

- ORA-00020: No more process state objects available (Database)

- Ubuntu installation module Python rq (Linux)

- To install MySQL 5.6 binary packages under CentOS 6.4 64bit (Database)

- How to extend / remove swap partitions (Linux)

- Spring loaded container finishes executing a method (Programming)

- Build your own Web server under Ubuntu Linux system (Server)

- Ubuntu Thunderbird 24.4.0 (Linux)

- Ubuntu 12.04 installation instructions under GAMIT10.40 (Linux)

- Use OpenSSL to generate a certificate detailed process (Linux)

- Ora-00020: maximum number of processes (500) exceeded (Database)

- Several reasons MySQL garbled (Database)

- Oracle in the add & split partition on the impact of global & local index (Database)

- Linux use iptables ban Ping (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:      
 
- Orionode source Linux Mint installation (Linux)
- Node.JS different ways to install under Ubuntu 15.04 (Linux)
- To install Xen in Ubuntu 12.04 (Linux)
- How do you temporarily emptied Bash environment variable before running the command on Linux (Linux)
- C language function pointer and a callback function (Programming)
- Linux --- file descriptors and redirection (Linux)
- Taught you how to install Ubuntu Linux (Linux)
- Pydev installed and configured on the Eclipse (Linux)
- Linux installation JDK1.6 rpm.bin assembly (Linux)
- GAMIT learning materials finishing (Linux)
- Internal class broadcasting needs public and static (Programming)
- Use Redis as time-series database: why and how (Database)
- Chrome plug-in management, online-offline installation, part of the plug presentations (Linux)
- Ubuntu 15.04 and Ubuntu 14.04 installed Cinnamon 2.6 (Linux)
- Reason C ++ program running under Linux a segmentation fault core dumped in (Programming)
- CentOS7 management of systemd (Linux)
- Unix / Linux commonly used to clean up disk space command (Linux)
- Ubuntu uses the / etc / profile file to configure the JAVA environment variable (Linux)
- Python script running in the background (Programming)
- VMware ghost Linux card error (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.