I can't configure datasource in weblogic and get error
Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
But db's and listener is startup and I can connect to db from SQLDeveloper and from simple java code with jdbc. I install Oracle DB client to server and add this to "PATH", but it don't work.
in listener log
11-ДЕК-2014 17:37:33 * service_update * rtu1 * 0
11-ДЕК-2014 17:38:20 * service_update * nsi * 0
11-ДЕК-2014 17:38:48 * service_update * rtuwh1 * 0
11-ДЕК-2014 17:39:53 * service_update * nsi * 0
11-ДЕК-2014 17:40:23 * (CONNECT_DATA=(SID=RTUARCH)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=fedorov))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.15.15)(PORT=1245)) * establish * RTUARCH * 0
11-ДЕК-2014 17:40:23 * (CONNECT_DATA=(SID=RTU1)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=fedorov))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.15.15)(PORT=1246)) * establish * RTU1 * 0
11-ДЕК-2014 17:40:23 * (CONNECT_DATA=(SID=RTU1)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=fedorov))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.15.15)(PORT=1247)) * establish * RTU1 * 0
11-ДЕК-2014 17:40:23 * (CONNECT_DATA=(SID=RTU1)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=fedorov))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.15.15)(PORT=1248)) * establish * RTU1 * 0
11-ДЕК-2014 17:40:23 * (CONNECT_DATA=(SID=RTUHW1)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=fedorov))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.15.15)(PORT=1249)) * establish * RTUHW1 * 12505
TNS-12505
Thanks.
As seen your error log, there is problem with your datasource. Double check your datasource. Also there is option of testing a datasource under monitoring tab.
It must give you success result.
Related
I have the database made in phpmyadmin and when I do the migration does not take me all the tables. when I try to create them through the code gives me error that the fields do not exist, in some cases the tables are created by the migration and gives me the same error. happens to me with the fields taken from another table ie the JoinColumn.
Example:
Menssage Error with php bin/console make:migration:
There is no column with name 'Usuario_Servicio_idServicio' on table 'sustitucion'.
Table Sustitucion:
/**
* #var \Usuario
*
* #ORM\Id
* #ORM\GeneratedValue(strategy="NONE")
* #ORM\OneToMany(targetEntity="Usuario", mappedBy="Usuario")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="Usuario_Servicio_idServicio", referencedColumnName="Servicio_idServicio")
* })
*/
private $usuarioServicUsuarioioIdservicio;
Table Usuario:
/**
* #var \Servicio|null
*
*
* #ORM\GeneratedValue(strategy="NONE")
* #ORM\ManyToOne(targetEntity="Servicio", cascade={"persist"})
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="Servicio_idServicio", referencedColumnName="idServicio")
* })
*/
private $servicioIdservicio;
Table Servicio:
/**
* #var int
*
* #ORM\Column(name="idServicio", type="integer", nullable=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $idservicio;
Is it possible that with doctrine it is not possible to make these relationships? How can I fix it or how else can I do it?
thank you
I wasn't sure what to title this post, if you can think of a better title, feel free to edit my post.
I have some visual foxpro that looks like this:
* Get the vendor code for case management hours
Select op_value ;
FROM dbfs\am_opts ;
WHERE op_code = "CMGT_VENDOR" ;
INTO CURSOR cmgt_vndr
lcCMGTVendor = padr(cmgt_vndr.op_value, 4)
* Determine if we need to include CMGT hours
llIncludeCMGT = .f.
Select sub_code ;
FROM tempsrv ;
WHERE Is_It_Case_Service(sub_code) ;
AND selected ;
INTO CURSOR c_dummy1
*
If _tally
> 0 or pcService = "ALL"
llIncludeCMGT = .t.
Endif
*
If m.llIncludeCMGT
* Pick only certain Vendors?
If m.pcVendor=="ALL"
* No, then leave the CMGT flag as DO Include.
Else
* Yes, only get CMGT if the "Default CMGT Vendor"
* is one of the selected vendors.
Select 'TempVnd'
Locate FOR provkey=m.lcCMGTVendor .AND. Selected
m.llIncludeCMGT = FOUND()
*
*
Endif
*
Endif
*
*
* Merge in CMGT hours if necessary
If llIncludeCMGT
Wait WINDOW NOWAIT ;
'Gathering Case-Management entries'
*
* 10/25/2001 JDB Take into account f_rpt.sub_code
*
Select 0
Use 'dbfs\f_Rpt' AGAIN ALIAS 'SQL_F_Rpt' NOUPDATE
*
* Build basic WHERE-clause, and name basic tables.
m.SQL_FROM = "SQL_F_Rpt"
m.SQL_WHERE = "SQL_F_Rpt.End_Dt BETWEEN m.pdBegin_Date AND m.pdEnd_Date" ;
+ " AND !(IS_IT_WAIVER(SQL_F_Rpt.Payor, .F.))"
*
* Do they only want certain Fund-Sources?
If m.pcPayor=="ALL"
* No, ignore the Payor-field
Else
* Yes, only get matching/selected payors.
m.SQL_FROM = m.SQL_FROM + ", TempPay"
m.SQL_WHERE = m.SQL_WHERE ;
+ " AND SQL_F_Rpt.Payor=TempPay.Payor_CD" ;
+ " AND TempPay.Selected"
*
Endif
*
* Pick only certain Service-Codes?
If m.pcService=="ALL"
* No, ignore the SubCode-field
Else
* Yes, only get matching/selected Services.
m.SQL_FROM = m.SQL_FROM + ", TempSrv"
m.SQL_WHERE = m.SQL_WHERE ;
+ " AND IIF(EMPTY(SQL_F_Rpt.Sub_Code), 'CMGT', SQL_F_Rpt.Sub_Code)=TempSrv.Sub_Code" ;
+ " AND TempSrv.Selected"
*
Endif
*
*
Select * from pass2 union all ;
select lcCMGTVendor as provkey, ;
iif(empty(SQL_F_Rpt.sub_code), "CMGT", SQL_F_Rpt.sub_code) as sub_code, ;
SQL_F_Rpt.keyfld, ;
00000.00 as tot_auth, ;
(SQL_F_Rpt.unit * SQL_F_Rpt.cost) as tot_deliv, ;
SQL_F_Rpt.start_dt as plandt ;
from &SQL_FROM ;
where &SQL_WHERE ;
into cursor pass3
I don't how the lcCMGTVendor is getting incorporated into the final foxpro query. It's not in the SQL_WHERE clause anywhere. It is not referenced anywhere else in the code, just this part.
Can someone help me figure out what I am missing in order to figure out how it is in the Foxpro query at the bottom?
In my current understanding, we are taking whatever the provkey value and literally applying it to every row, which seems wrong.
OK, you want to convert parts of it, then the "part" you are asking to, in practice correspond to:
Foxpro code:
* Get the vendor code for case management hours
Select op_value ;
FROM dbfs\am_opts ;
WHERE op_code = "CMGT_VENDOR" ;
INTO CURSOR cmgt_vndr
lcCMGTVendor = padr(cmgt_vndr.op_value, 4)
T-SQL:
declare #lcCMGTVendor char(20+4); -- if op_value size is char(20)
Select top(1) #lcCMGTVendor = op_value
FROM am_opts
WHERE op_code = 'CMGT_VENDOR';
IMHO padr() was not something necessary even in foxpro code. Above code anyway use char(20+4) instead of varchar() - foxpro fields have trailing spaces.
I want get all locations around my location but the function ST_Distance_Sphere does not work.
My query:
select *, astext(location) as location from `locations`
where ST_Distance_Sphere(location, POINT(35.905069591297, 49.765869174153)) < 1000
Error :
SQLSTATE[42000]: Syntax error or access violation:
1305 FUNCTION app.ST_Distance_Sphere does not exist (SQL:
select *, astext(location) as location from `locations`
where ST_Distance_Sphere(location, POINT(35.905069591297, 49.765869174153)) < 1000)
For those who still need the function in MariaDB, you can create the function based on the formula
CREATE FUNCTION `st_distance_sphere`(`pt1` POINT, `pt2` POINT) RETURNS
decimal(10,2)
BEGIN
return 6371000 * 2 * ASIN(SQRT(
POWER(SIN((ST_Y(pt2) - ST_Y(pt1)) * pi()/180 / 2),
2) + COS(ST_Y(pt1) * pi()/180 ) * COS(ST_Y(pt2) *
pi()/180) * POWER(SIN((ST_X(pt2) - ST_X(pt1)) *
pi()/180 / 2), 2) ));
END
10.2+
This issue has been fixed and backported with MDEV-13467. It's available 10.2.38, 10.3.29, 10.4.19, 10.5.10
Find their support matrix here.
http://mysql.rjweb.org/doc.php/find_nearest_in_mysql#gcdistdeg
That blog discusses multiple ways of "finding nearest" on the globe in MySQL/MariaDB. As part of that discussion, I developed that Stored Function.
I think that's it ST_DISTANCE https://mariadb.com/kb/en/library/st_distance/
I am using Codeigniter 2.1 and Microsoft Sql Server. When I try to insert UTF8 strings in database I get ??? characters. To connect to database I use SqlSrv driver.
Small change in SqlSrv driver solves the problem with unicode.
Just add _make_unicode function code to /system/database/sqlsrv/sqlsrv_driver.php and replace the code for _insert and _update functions
/**
* #param mixed $value
*/
function _make_unicode($value){
if(is_string($value) && $value!="NULL")return "N".$value;
else return $value;
}
/**
* Insert statement
*
* Generates a platform-specific insert string from the supplied data
*
* #access public
* #param string the table name
* #param array the insert keys
* #param array the insert values
* #return string
*/
function _insert($table, $keys, $values)
{
$values_string = "";
for($i=0;$i<count($values);$i++){
if($i==0){
$values_string.= $this->_make_unicode($values[$i]);
}else{
$values_string.= ", ".$this->_make_unicode($values[$i]);
}
}
return "INSERT INTO ".$this->_escape_table($table)." (".implode(', ', $keys).") VALUES ({$values_string})";
}
// --------------------------------------------------------------------
/**
* Update statement
*
* Generates a platform-specific update string from the supplied data
*
* #access public
* #param string the table name
* #param array the update data
* #param array the where clause
* #param array the orderby clause
* #param array the limit clause
* #return string
*/
function _update($table, $values, $where)
{
foreach($values as $key => $val)
{
$valstr[] = $key." = ".$this->_make_unicode($val);
}
return "UPDATE ".$this->_escape_table($table)." SET ".implode(', ', $valstr)." WHERE ".implode(" ", $where);
}
// --------------------------------------------------------------------
Adding to Alex's answer (sorry not enough reputation to comment). Here are the same functions for CodeIgniter 3.1.1.
_insert_batch
/**
* Insert batch statement
*
* Generates a platform-specific insert string from the supplied data.
*
* #param string $table Table name
* #param array $keys INSERT keys
* #param array $values INSERT values
* #return string|bool
*/
protected function _insert_batch($table, $keys, $values)
{
// Multiple-value inserts are only supported as of SQL Server 2008
if (version_compare($this->version(), '10', '>='))
{
foreach($values as &$value) {
$value = $this->_make_unicode($value);
}
return parent::_insert_batch($table, $keys, $values);
}
return ($this->db->db_debug) ? $this->db->display_error('db_unsupported_feature') : FALSE;
}
_update
/**
* Update statement
*
* Generates a platform-specific update string from the supplied data
*
* #param string $table
* #param array $values
* #return string
*/
protected function _update($table, $values)
{
foreach ($values as &$value) {
$value = $this->_make_unicode($value);
}
$this->qb_limit = FALSE;
$this->qb_orderby = array();
return parent::_update($table, $values);
}
I want to select rows which contains an IP address in a nvarchar column. What's the correct where statement?
SELECT * FROM tblUrl WHERE ... (Url contains an IP address)
The "usual way" to encode IP address in Database is either:
192.168.001.010 (note the padding "0"s)
or
as a integer being (((192 * 256)+ 168 )* 256 + 1 )*256 +10
Both formats allow you to quickly match for an ip in an interval:
SELECT * FROM tblURL where URL > "192.168.010.000" and URL < "192.168.011.255"
or
SELECT * FROM tblURL where URL > 3232238080 and URL < 3232239080
If you table tblUrl contains URLs as suggested by your question, then you should perform a DNS lookup first to resolve the name into an IP Address.
You could simply do this
SELECT * FROM tblUrl WHERE URL like '192.168.1.%'
which will select all ip addresses from 192.168.1.1 to .254
Or you can be more creative such as
SELECT * FROM tblUrl WHERE URL like '192.168.1.[0-9][0-9]'
this will select all IP addresses 192.168.1.10 to .99