Hatena::ブログ(Diary)

マイノート

2015-07-30

2015-07-29

node-oracledb

https://www.npmjs.com/package/oracledb

https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#instoh


(test_oracledb.js)

#!/usr/bin/env node

var oracledb = require('oracledb');

oracledb.getConnection(
  {
    user          : "hr",
    password      : "*****",
    connectString : "localhost/XE"
  },
  function(err, connection)
  {
    if (err) {
      console.error(err.message);
      return;
    }
    connection.execute(
      "SELECT * FROM jobs",
      function(err, result)
      {
        if (err) {
          console.error(err.message);
          return;
        }
        console.log(result.rows);
      });
  });

$ ./test_oracledb.js 
[ [ 'AD_PRES', 'President', 20080, 40000 ],
  [ 'AD_VP', 'Administration Vice President', 15000, 30000 ],
  [ 'AD_ASST', 'Administration Assistant', 3000, 6000 ],
  [ 'FI_MGR', 'Finance Manager', 8200, 16000 ],
  [ 'FI_ACCOUNT', 'Accountant', 4200, 9000 ],
  [ 'AC_MGR', 'Accounting Manager', 8200, 16000 ],
  [ 'AC_ACCOUNT', 'Public Accountant', 4200, 9000 ],
  [ 'SA_MAN', 'Sales Manager', 10000, 20080 ],
  [ 'SA_REP', 'Sales Representative', 6000, 12008 ],
  [ 'PU_MAN', 'Purchasing Manager', 8000, 15000 ],
  [ 'PU_CLERK', 'Purchasing Clerk', 2500, 5500 ],
  [ 'ST_MAN', 'Stock Manager', 5500, 8500 ],
  [ 'ST_CLERK', 'Stock Clerk', 2008, 5000 ],
  [ 'SH_CLERK', 'Shipping Clerk', 2500, 5500 ],
  [ 'IT_PROG', 'Programmer', 4000, 10000 ],
  [ 'MK_MAN', 'Marketing Manager', 9000, 15000 ],
  [ 'MK_REP', 'Marketing Representative', 4000, 9000 ],
  [ 'HR_REP', 'Human Resources Representative', 4000, 9000 ],
  [ 'PR_REP', 'Public Relations Representative', 4500, 10500 ] ]

DBD::Oracle

http://stackoverflow.com/questions/11407513/perl-dbdoracle-module-installation

http://search.cpan.org/~pythian/DBD-Oracle-1.23/Oracle.pm

http://perl.dbi.users.narkive.com/0Tkjxsm3/how-to-set-ld-library-path


(test_dbd_oracle.pl)

#!/usr/bin/env perl

use DBD::Oracle;

$ENV{ORACLE_HOME} = "/u01/app/oracle/product/11.2.0/xe";

$driver = 'Oracle';
$host = 'localhost';
$sid = 'xe';

$dbh = DBI->connect("dbi:$driver:host=$host;sid=$sid","hr","*****");
$sth = $dbh->prepare("select * from jobs");
$sth->execute;
while(@row = $sth->fetchrow){
  print "@row\n";
}

$ ./test_dbd_oracle.pl 
AD_PRES President 20080 40000
AD_VP Administration Vice President 15000 30000
AD_ASST Administration Assistant 3000 6000
FI_MGR Finance Manager 8200 16000
FI_ACCOUNT Accountant 4200 9000
AC_MGR Accounting Manager 8200 16000
AC_ACCOUNT Public Accountant 4200 9000
SA_MAN Sales Manager 10000 20080
SA_REP Sales Representative 6000 12008
PU_MAN Purchasing Manager 8000 15000
PU_CLERK Purchasing Clerk 2500 5500
ST_MAN Stock Manager 5500 8500
ST_CLERK Stock Clerk 2008 5000
SH_CLERK Shipping Clerk 2500 5500
IT_PROG Programmer 4000 10000
MK_MAN Marketing Manager 9000 15000
MK_REP Marketing Representative 4000 9000
HR_REP Human Resources Representative 4000 9000
PR_REP Public Relations Representative 4500 10500

2015-07-25

2015-07-20

2015-07-19

2015-06-24

(((;゚Д゚)))))))

セ・リーグ

試合数勝数負数引分数勝率 勝差残試合得点失点本塁打盗塁打率防御率
1位 阪神 68 34 33 1.507-75215287 34 23 .2353.79
2位 巨人 71 35 36 0.493172228216 39 56 .2382.78
3位 DeNA 70 34 35 1.4930 73257 280 53 35 .2573.59
4位 ヤクルト 69 32 36 1.4711.574247 243 45 34 .2473.20
5位 中日 71 32 38 1.457172236255 35 50 .2613.19
6位 広島 67 30 36 1.455076265239 53 40 .2603.22