Wednesday, May 8, 2013

ORACLE 11G CONNECT WITH PHP ON WINDOWS




STEP-1

 CREATE DSN USING ADMINISTRATOR TOOL




<html>
<body>

<?php
$conn=odbc_connect('orcl11g','hr','hr');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM test";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}
echo "<table><tr>";
echo "<th>ID</th>";
echo "<th>Name</th></tr>";
while (odbc_fetch_row($rs))
  {
  $compname=odbc_result($rs,"id");
  $conname=odbc_result($rs,"name");
  echo "<tr><td>$compname</td>";
  echo "<td>$conname</td></tr>";
  }
odbc_close($conn);
echo "</table>";
?>

</body>
</html>

Friday, April 26, 2013


TO  CONNECT USING SHELL SCRIPTING FROM ROOT USER (CRON TAB)


PATH=$PATH:$HOME/bin

export PATH

ORACLE_SID=orcl
ORACLE_BASE=/oracle/product/10.2.0
ORACLE_HOME=$ORACLE_BASE/db_1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH

sqlplus -s hr/hr@orcl  @ /home/oracle/Desktop/a.sql

CONFIGURE SQLDEVELOPER TOOL

ON LINUX ENVIRONMENT

FIRST STEP DOWNLOAD

http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

SECOND STEP DOWNLOAD JAVA

 http://www.oracle.com/technetwork/java/javase/downloads/index.html



SET PATH IN  SQLDEVELOPER.CONF
 SetJavaHome /usr/java/jdk1.7.0_21/

ENJOY

Sunday, April 21, 2013

CONNECT ORACLE DB USING SHELL SCRIPT


CAN COPY THIS PATH FROM .BASH_PROFILE IN ORACLE HOME




PATH=$PATH:$HOME/bin

export PATH

ORACLE_SID=orcl
ORACLE_BASE=/oracle/product/10.2.0
ORACLE_HOME=$ORACLE_BASE/db_1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH

sqlplus -s hr/hr@orcl  @ /home/oracle/Desktop/a.sql



/////////////////////////////////////////////////////////////////////////////////////////////////////////
a.sql contain query to execute on database;
ex - create table test values(id number,name varchar2(30));