Posts

Showing posts with the label Tin tức công nghệ

Query data from Oracle

using System; using System.Data; using System.Configuration; using System.Collections.Generic; using System.Text; using System.Xml; using System.Collections; using System.Data.OleDb; string connectionString = @"Provider=MSDAORA.1;user id=username; password=mypass; data source=" + "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)" + "(HOST=IPADDRESS)(PORT=1521))(CONNECT_DATA=" + "(SERVICE_NAME=servicename)))"; OleDbConnection con = new OleDbConnection(connectionString); con.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("select * from table_data", con); DataSet set = new DataSet(); adapter.Fill(set);

Oracle: Using Statspack Report

Image
Statspack is a set of performance monitoring and reporting utilities provided by Oracle starting from Oracle 8i and above. When you run the Statspack installation script, the PERFSTAT user is created automatically. PERFSTAT owns all objects needed by the Statspack package Note: All sql scripts are store in $ORACLE_HOME/rdbms/admin To Install statspack cd $ORACLE_HOME/rdbms/admin sqlplus / as sysdba @spcreate To schedule an hourly snapshot cd $ORACLE_HOME/rdbms/admin sqlplus perfstat/perfstat @spauto.sql To take a snapshot manually cd $ORACLE_HOME/rdbms/admin sqlplus perfstat/perfstat exec statspack.snap; Or exec statspack.snap(i_snap_level => 6, i_modify_parameter => 'true'); To generate statspack report cd $ORACLE_HOME/rdbms/admin sqlplus perfstat/perfstat @spreport.sql to delete snapshots cd $ORACLE_HOME/rdbms/admin sqlplus perfstat/perfstat @sppurge; To list all generated snapshots cd $ORACLE_HOME/rdbms/admin sqlplus perfstat/perfstat select snap_id, ...

Using SubSonic Within Transactions

First, you must add reference to System.Transaction.dll And here is an example code: //use the product object to test the transaction scope 51 using ( TransactionScope scope = new TransactionScope ()) { 52 53 try { 54 Product p1 = new Product ( 1 ); 55 p1 . QuantityPerUnit = "10 boxes x 30 bags" ; 56 p1 . Save ( "Unit Test" ); 57 58 Product p2 = new Product ( 2 ); 59 p2 . QuantityPerUnit = "24 - 42 oz bottles" ; 60 p2 . Save ( "Unit Test" ); 61 62 Product p3 = new Product ( 3 ); 63 p3 . QuantityPerUnit = "12 - 5500 ml bottles" ; 64 p3 . Save ( "Unit Test" ); 65 66 scope . Complete (); 67 68 } catch ( System . Data . SqlClient . SqlE...