Unable to connect to Oracle Instance using SQL Developer - oracle-sqldeveloper

Dear Friends,
I have an instance of Oracle 11g installed in my test m/c.In my development m/c have installed SQL developer.But I am unable to connect to DB although both machines are on the LAN and are accessible otherwise for folder sharing
The error message I get is
"Test Failed :IO Error:The Network Adaptor could not establish the connection"
Although I am able to connect to DB when SQL developer is on same machine.
Thanks in advance for helping.
# listener.ora Network Configuration File: C:\app\enduser\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\enduser\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\enduser\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\app\enduser
And TNSName.ora is
# tnsnames.ora Network Configuration File: C:\app\enduser\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
>
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.18.2.127)
)
)

Related

Oracle DB 12c connection issue

I am facing an Oracle DB 12c connection issue with the error mentioned below.
ORA-12505, TNS:listener does not currently know of SID given in
connect descriptor
Screen shot showing the error message posted below.
tnsnames.ora file content generated by Oracle configuration tools posted below.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1588))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
You entered ORADIM into the SID item. There's no database called "ORADIM" in your TNSNAMES.ORA.
If I were you', I'd try with
ORCL or
PDBORCL
entered into SERVICE_NAME.

Importing data into my database where dump file is my c drive

When I am doing import command I am getting
Ora-12154 TNS:could not resolve the connect identifier specified
My command is:
impdp CLIENT1/Login1234#orcl dumpfile=c:/pdsr27hjh.dmp logfile=ohgiu78_1.dmp full=y
this is my tnsname.ora file
ORACLR_CONNECTION_DATA = (
DESCRIPTION = (
ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO) ) )
ORCL = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = poc4db.poc4db.i7.internal.cloudapp.net) (PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = orcl.poc4db.i7.internal.cloudapp.net) ) )

sphinx autocomplete CALL SNIPPETS excerpts not returning result set

i am able to get a result set from print_r($stmt->fetchAll()); however, i cannot get a result set from print_r($r); below is the exact code from https://github.com/adriannuta/SphinxAutocompleteExample. the only change is the sql_query inside the sphinx.conf file.
ajax_suggest_excerpts.php
require_once 'common.php';
require_once 'functions.php';
$indexes = 'simplecomplete';
$arr =array();
$q = trim($_GET['term']);
$stmt = $ln_sph->prepare("SELECT * FROM $indexes WHERE MATCH(:match) LIMIT 0,10 OPTION ranker=sph04");
$aq = explode(' ',$q);
if(strlen($aq[count($aq)-1])<3){
$query = $q;
}else{
$query = $q.'*';
}
$stmt->bindValue(':match', $query,PDO::PARAM_STR);
$stmt->execute();
$docs = array();
$title = "";
$stmsnp = $ln_sph->prepare("CALL SNIPPETS(:doc,'simplecomplete',:query)");
$stmsnp->bindValue(':query',$query,PDO::PARAM_STR);
$stmsnp->bindParam(':doc',$title,PDO::PARAM_STR);
print_r($stmt->fetchAll()); //THIS RETURNS RESULT SET
foreach($stmt->fetchAll() as $r){
$title = $r['city'];
$stmsnp->execute();
$r = $stmsnp->fetch();
print_r($r); //THIS DOES NOT.
$arr[] = array('id' => utf8_encode($r['city']),'label' =>utf8_encode( $r['city']));
}
echo json_encode($arr);
exit();
sphinx.conf
source simplecomplete
{
type = mysql
sql_host = localhost
sql_user = swflorib
sql_pass = cii65419
sql_db = swflorib_db
sql_port = 3306 # optional, default is 3306
sql_query = SELECT id, Sic_Code_description, Sic_Code6_Description, City, hidden_keywords FROM no_admin_emails GROUP BY Company_Name
sql_field_string = Sic_Code_description
sql_field_string = Sic_Code6_Description
sql_field_string = City
sql_field_string = hidden_keywords
}
index simplecomplete
{
source = simplecomplete
path = /usr/local/sphinx/var/data/simplecomplete
docinfo = extern
charset_type = utf-8
min_word_len = 3
enable_star = 1
min_prefix_len = 3
}
From the documentation of fetchAll
http://us3.php.net/manual/en/pdostatement.fetchall.php
returns an array containing all of the remaining rows in the result set.
So the fetchAll inside the print_r() fetches all the rows from the database. The fetchAll inside the foreach() then has no rows left to fetch!
Looks like a misunderstanding of PHP/pdo.

PAY PAL IPN stop working

My code stop working, I have made some changes like $res=trim($res); as I saw in another question but still not working.
The code was perfectly working including automatic post in Facebook and Tweeter.
Please, could someone check my code and help me to fix it?
<?php
// Revision Notes
// 11/04/11 - changed post back url from https://www.paypal.com/cgi-bin/webscr to https://ipnpb.paypal.com/cgi-bin/webscr
// For more info see below:
// https://www.x.com/content/bulletin-ip-address-expansion-paypal-services
// "ACTION REQUIRED: if you are using IPN (Instant Payment Notification) for Order Management and your IPN listener script is behind a firewall that uses ACL (Access Control List) rules which restrict outbound traffic to a limited number of IP addresses, then you may need to do one of the following:
// To continue posting back to https://www.paypal.com to perform IPN validation you will need to update your firewall ACL to allow outbound access to *any* IP address for the servers that host your IPN script
// OR Alternatively, you will need to modify your IPN script to post back IPNs to the newly created URL https://ipnpb.paypal.com using HTTPS (port 443) and update firewall ACL rules to allow outbound access to the ipnpb.paypal.com IP ranges (see end of message)."
/////////////////////////////////////////////////
/////////////Begin Script below./////////////////
/////////////////////////////////////////////////
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$value = preg_replace('/(.*[^%^0^D])(%0A)(.*)/i','${1}%0D%0A${3}',$value);// IPN fix
$req .= "&$key=$value";
}
// post back to PayPal system to validate
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Host: www.paypal.com\r\n";
//$header .= "Host: www.sandbox.paypal.com\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
// If testing on Sandbox use:
//$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
$fp = fsockopen ('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$business = $_POST['business'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$mc_gross = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$receiver_id = $_POST['receiver_id'];
$quantity = $_POST['quantity'];
$num_cart_items = $_POST['num_cart_items'];
$payment_date = $_POST['payment_date'];
$first_name = $_POST['fir st_name'];
$last_name = $_POST['last_name'];
$payment_type = $_POST['payment_type'];
$payment_status = $_POST['payment_status'];
$payment_gross = $_POST['payment_gross'];
$payment_fee = $_POST['payment_fee'];
$settle_amount = $_POST['settle_amount'];
$memo = $_POST['memo'];
$payer_email = $_POST['payer_email'];
$txn_type = $_POST['txn_type'];
$payer_status = $_POST['payer_status'];
$address_street = $_POST['address_street'];
$address_city = $_POST['address_city'];
$address_state = $_POST['address_state'];
$address_zip = $_POST['address_zip'];
$address_country = $_POST['address_country'];
$address_status = $_POST['address_status'];
$item_number = $_POST['item_number'];
$tax = $_POST['tax'];
$option_name1 = $_POST['option_name1'];
$option_selection1 = $_POST['option_selection1'];
$option_name2 = $_POST['option_name2'];
$option_selection2 = $_POST['option_selection2'];
$for_auction = $_POST['for_auction'];
$invoice = $_POST['invoice'];
$custom = $_POST['custom'];
$notify_version = $_POST['notify_version'];
$verify_sign = $_POST['verify_sign'];
$payer_business_name = $_POST['payer_business_name'];
$payer_id =$_POST['payer_id'];
$mc_currency = $_POST['mc_currency'];
$mc_fee = $_POST['mc_fee'];
$exchange_rate = $_POST['exchange_rate'];
$settle_currency = $_POST['settle_currency'];
$parent_txn_id = $_POST['parent_txn_id'];
$pending_reason = $_POST['pending_reason'];
$reason_code = $_POST['reason_code'];
// subscription specific vars
$subscr_id = $_POST['subscr_id'];
$subscr_date = $_POST['subscr_date'];
$subscr_effective = $_POST['subscr_effective'];
$period1 = $_POST['period1'];
$period2 = $_POST['period2'];
$period3 = $_POST['period3'];
$amount1 = $_POST['amount1'];
$amount2 = $_POST['amount2'];
$amount3 = $_POST['amount3'];
$mc_amount1 = $_POST['mc_amount1'];
$mc_amount2 = $_POST['mc_amount2'];
$mc_amount3 = $_POST['mcamount3'];
$recurring = $_POST['recurring'];
$reattempt = $_POST['reattempt'];
$retry_at = $_POST['retry_at'];
$recur_times = $_POST['recur_times'];
$username = $_POST['username'];
$password = $_POST['password'];
//auction specific vars
$for_auction = $_POST['for_auction'];
$auction_closing_date = $_POST['auction_closing_date'];
$auction_multi_item = $_POST['auction_multi_item'];
$auction_buyer_id = $_POST['auction_buyer_id'];
//DB connect creds and email
$notify_email = "xxxxxx#gmail.com"; //email address to which debug emails are sent to
$DB_Server = "localhost"; //your MySQL Server
$DB_Username = "xxxxx"; //your MySQL User Name
$DB_Password = "xxxxx"; //your MySQL Password
$DB_DBName = "xxxxx"; //your MySQL Database Name
if (!$fp)
{
// HTTP ERROR
}
else
{
fputs ($fp, $header . $req);
while (!feof($fp))
{
$res = fgets ($fp, 1024);
$res=trim($res);
if (strcmp ($res, "VERIFIED") == 0)
//if (strcmp ($res, "VERIFIED\r\n") == 0)
{
//create MySQL connection
$Connect = #mysql_connect($DB_Server, $DB_Username, $DB_Password)
or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . mysql_errno());
//select database
$Db = #mysql_select_db($DB_DBName, $Connect)
or die("Couldn't select database:<br>" . mysql_error(). "<br>" . mysql_errno());
$fecha = date("m")."/".date("d")."/".date("Y");
$fecha = date("Y").date("m").date("d");
//check if transaction ID has been processed before
$checkquery = "select txnid from paypal_payment_info where txnid='".$txn_id."'";
$sihay = mysql_query($checkquery) or die("Duplicate txn id check query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
$nm = mysql_num_rows($sihay);
if ($nm == 0)
{
//execute query
$strQuery = "insert into paypal_payment_info(paymentstatus,buyer_email,receiver_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$receiver_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')";
$result = mysql_query("insert into paypal_payment_info(paymentstatus,buyer_email,receiver_email,firstname,lastname,street,city,state,zipcode,country,mc_gross,mc_fee,quantity,memo,paymenttype,paymentdate,txnid,pendingreason,reasoncode,tax,datecreation) values ('".$payment_status."','".$payer_email."','".$receiver_email."','".$first_name."','".$last_name."','".$address_street."','".$address_city."','".$address_state."','".$address_zip."','".$address_country."','".$mc_gross."','".$mc_fee."','".$quantity."','".$memo."','".$payment_type."','".$payment_date."','".$txn_id."','".$pending_reason."','".$reason_code."','".$tax."','".$fecha."')")
or die("Default - paypal_payment_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno());
{
$consumerKey = 'ccYgLrtBUrgIPJDQ';
$consumerSecret = '4qXLLXdQPcKqAqKscYQH9p9m3cznyVWYc4v8';
$oAuthToken = 'uVgkQTC0BLNT9V9vTpc25poxDgIomCgMbw';
$oAuthSecret = 'L8rfc6A1Ii5cMeuYEhf6hwkc3aATyo';
require_once('twitteroauth.php');
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
$tweet->post('statuses/update', array('status' => 'Last donation US$ '.$mc_gross.' to '.$item_name.' '));
}
mail($notify_email, "VERIFIED IPN", "$res\n $req\n $strQuery\n $struery\n $strQuery2");
$sql = mysql_query(" UPDATE cadastros SET amount='$mc_gross'-'$mc_fee'+amount, mc_gross = '$mc_gross' , mc_fee ='$mc_fee', payment_date = '$payment_date',pay_date = now() WHERE receiver_email='$receiver_email'");
$result = mysql_query($sql) or die( mysql_error() );
}
else
{
// send an email
mail($notify_email, "VERIFIED DUPLICATED TRANSACTION", "$res\n $req\n $strQuery\n $struery\n $strQuery2");
}
// if the IPN POST was 'INVALID'...do this
}
else if (strcmp ($res, "INVALID") == 0)
{
// log for manual investigation
mail($notify_email, "INVALID IPN", "$res\n $req");
}
}
fclose ($fp);
}
?>
The HOST tag in the header has to match the URL you are using with fsockopen.
Try this:
$sandbox = 1;
$paypalURL = $sandbox ? 'www.sandbox.paypal.com' : 'www.paypal.com';
// Create http header
$header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Host: $paypalURL\r\n";
$header .= "Connection: close\r\n\r\n";
// Post back to PayPal system to verify
$fp = fsockopen('ssl://'.$paypalURL, 443, $errno, $errstr, 30);

how to connect sql server with linux?

Whenever i will run Perl code i got following error:
DBI connect('SQLSERVER','rti_dbuser',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at /usr/WINAST/RTI/AGI/M_TEST.pl line 14
Coudn't Connect SQL at /usr/WINAST/RTI/AGI/M_TEST.pl line 14.
The configuration file are given below:
odbc.ini
[SQLSERVER]
description = Asterisk ODBC for SQL SERVER
;driver = FreeTDS
Driver = /usr/local/lib/libtdsodbc.so
server = 10.2.20.42\APSHCL
Database = RTI
port = 1433
tds_version = 9.0
try domain login = yes
try server login = yes
nt domain = DOMAIN
language = us_english
odbcinst.ini
[FreeTDS]
Description = FreeTDS ODBC driver for MSSQL
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsS.so
FileUsage = 1
My code
use DBI;
use Data::Dumper;
use Asterisk::AGI;
my $agi = new Asterisk::AGI;
$first_param = $ARGV[0];
my $DSN = q/dbi:ODBC:SQLSERVER/;
my $uid = q/username/;
my $pwd = q/password/;
my $DRIVER = "Freetds";
my $dbh = DBI->connect($DSN,$uid,$pwd) or die "Coudn't Connect SQL";
my $servernumber = 2;
my $sql = "EXEC usp_check_black_list '".$first_param."'" ;
my $sth = $dbh->prepare($sql);
$sth->execute();
$return = $sth->fetchrow();
$agi->set_variable('result',$return);
print Dumper($return);
$sth->finish;
$dbh->disconnect;
whenever i'm executing my perl code, the driver is not found.I have already define the driver but it is not use that driver....
please help me...
Try using DBD::Sybase. MSSQL is a fork from the Sybase code, and DBD::Sybase still works pretty well, though YMMV.