OracleDataSource Demo : Oracle JDBC : Database SQL JDBC : Java examples (example source code) Organized by topic

Java
C++
PHP


Java  »  Database SQL JDBC   » [  Oracle JDBC  ]  Screenshots 
 



OracleDataSource Demo

import java.sql.*;
import oracle.jdbc.pool.*;

public class TestThinDSApp {

  public static void main(String args[]) throws ClassNotFoundException,
      SQLException {

    // These settings are typically configured in JNDI
    // so they a implementation specific
    OracleDataSource ds = new OracleDataSource();
    ds.setDriverType("thin");
    ds.setServerName("dssw2k01");
    ds.setPortNumber(1521);
    ds.setDatabaseName("orcl")// sid
    ds.setUser("scott");
    ds.setPassword("tiger");

    Connection conn = ds.getConnection();

    Statement stmt = conn.createStatement();
    ResultSet rset = stmt
        .executeQuery("select 'Hello Thin driver data source tester '||"
            "initcap(USER)||'!' result from dual");
    if (rset.next())
      System.out.println(rset.getString(1));
    rset.close();
    stmt.close();
    conn.close();
  }
}

           
       
Related examples in the same category
1.  Get Object From Oracle Database Using STRUCTHas Download File
2.  Inser BLOG(Picture or Photo) Data Type Into Oracle DatabaseHas Download File
3.  Serialized And Deserialize Object OracleHas Download File
4.  Get Oracle Table NamesHas Download File
5.  Get Parameter MetaData From Oracle JDBC DriverHas Download File
6.  Test Oracle JDBC Driver Installation
7.  Create Employee Table Oracle
8.  Count row in Oracle
9.  Get Column Names From ResultSet for Oracle
10.  Demo ResultSet Oracle
11.  All data types for Oracle
12.  Get Column Privileges Oracle
13.  Test OCINet 8 App
14.  Test SSL
15.  Test Data Encryption Integrity
16.  Test DataSource LookUp
17.  Register custome type to Oracle
18.  Insert custom type to Oracle
19.  Check JDBC Installation for Oracle
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.