I have a website built on Zend Framework. I want to run the site on my local machine.
I am using wamp server and I created the database for the website.
When loading the site I get the following errors:
( ! ) Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access denied for user 'devhyper_links'#'localhost' (using password: YES)' in E:\wamp\www\hyper\code\library\Zend\Db\Adapter\Pdo\Abstract.php on line 144
( ! ) PDOException: SQLSTATE[28000] [1045] Access denied for user 'devhyper_links'#'localhost' (using password: YES) in E:\wamp\www\hyper\code\library\Zend\Db\Adapter\Pdo\Abstract.php on line 129
Call Stack
# Time Memory Function Location
1 0.0006 368952 {main}( ) ..\index.php:0
2 0.0422 1681728 Zend_Application->bootstrap( ) ..\index.php:20
3 0.0422 1681760 Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( ) ..\Application.php:355
4 0.0422 1681760 Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:583
5 0.1858 5863392 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( ) ..\BootstrapAbstract.php:619
6 0.1858 5863520 MKLib_Application_Bootstrap_Bootstrap->_initUtf8( ) ..\BootstrapAbstract.php:666
7 0.1970 6299480 Zend_Db_Adapter_Pdo_Abstract->exec( ) ..\Bootstrap.php:60
8 0.1970 6299480 Zend_Db_Adapter_Abstract->getConnection( ) ..\Abstract.php:263
9 0.1970 6299480 Zend_Db_Adapter_Pdo_Mysql->_connect( ) ..\Abstract.php:315
10 0.1970 6299480 Zend_Db_Adapter_Pdo_Abstract->_connect( ) ..\Mysql.php:96
11 0.1970 6299968 PDO->__construct( ) ..\Abstract.php:129
( ! ) Zend_Db_Adapter_Exception: SQLSTATE[28000] [1045] Access denied for user 'devhyper_links'#'localhost' (using password: YES) in E:\wamp\www\hyper\code\library\Zend\Db\Adapter\Pdo\Abstract.php on line 144
Call Stack
# Time Memory Function Location
1 0.0006 368952 {main}( ) ..\index.php:0
2 0.0422 1681728 Zend_Application->bootstrap( ) ..\index.php:20
3 0.0422 1681760 Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( ) ..\Application.php:355
4 0.0422 1681760 Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:583
5 0.1858 5863392 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( ) ..\BootstrapAbstract.php:619
6 0.1858 5863520 MKLib_Application_Bootstrap_Bootstrap->_initUtf8( ) ..\BootstrapAbstract.php:666
7 0.1970 6299480 Zend_Db_Adapter_Pdo_Abstract->exec( ) ..\Bootstrap.php:60
8 0.1970 6299480 Zend_Db_Adapter_Abstract->getConnection( ) ..\Abstract.php:263
9 0.1970 6299480 Zend_Db_Adapter_Pdo_Mysql->_connect( ) ..\Abstract.php:315
10 0.1970 6299480 Zend_Db_Adapter_Pdo_Abstract->_connect( ) ..\Mysql.php:96
You have to
Create a database user devhyper_links on your local MySQL database
Grant appropriate privileges for devhyper_links to your local MySQL database
Something like
GRANT ALL ON db_name.* TO "devhyper_links"#"localhost" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
Please note that ALL privileges may be too open. Customise at your discretion.
See http://dev.mysql.com/doc/refman/5.5/en/grant.html#grant-privileges
Related
I am new to PL/SQL and I can't figure out what is the problem in the following function, as I get the error ORA-00904: par_cantitate invalid identifier. Please, please could you help me. Thank you!
CREATE OR REPLACE FUNCTION vanzari_med(par_cantitate
ProduseVandute.Cantitate%TYPE)
RETURN NUMBER IS
c ProduseVandute.Cantitate%TYPE;
s Medicament.Stoc%TYPE;
NO_SALES EXCEPTION;
BEGIN
SELECT Stoc INTO s
FROM ProduseVandute pv, Medicament m
WHERE pv.Cantitate=m.Stoc and Cantitate=par_cantitate;
IF s<>15
THEN RAISE NO_SALES;
ELSE
SELECT Cantitate INTO c
FROM ProduseVandute pv, Medicament m,(SELECT * FROM Vanzari GROUP
BY ID_Vanzari)v
WHERE Cantitate=par_cantitate and pv.Cantitate=m.Stoc and
pv.ID_Vanzari=v.ID_Vanzari;
END IF;
RETURN c;
END vanzari_med
Are you sure? If tables you used contain at least columns from this function, then it compiles. Though, as you didn't handle exception you raised, it might not work properly, but - it compiles.
Sample tables:
SQL> CREATE TABLE ProduseVandute
2 (
3 cantitate NUMBER,
4 id_vanzari NUMBER
5 );
Table created.
SQL> CREATE TABLE medicament
2 (
3 stoc NUMBER
4 );
Table created.
SQL> CREATE TABLE vanzari
2 (
3 id_vanzari NUMBER
4 );
Table created.
Your function, unmodified (just added terminators at the end):
SQL> CREATE OR REPLACE FUNCTION vanzari_med(par_cantitate
2 ProduseVandute.Cantitate%TYPE)
3 RETURN NUMBER IS
4 c ProduseVandute.Cantitate%TYPE;
5 s Medicament.Stoc%TYPE;
6 NO_SALES EXCEPTION;
7 BEGIN
8 SELECT Stoc INTO s
9 FROM ProduseVandute pv, Medicament m
10 WHERE pv.Cantitate=m.Stoc and Cantitate=par_cantitate;
11 IF s<>15
12 THEN RAISE NO_SALES;
13 ELSE
14 SELECT Cantitate INTO c
15 FROM ProduseVandute pv, Medicament m,(SELECT * FROM Vanzari GROUP
16 BY ID_Vanzari)v
17 WHERE Cantitate=par_cantitate and pv.Cantitate=m.Stoc and
18 pv.ID_Vanzari=v.ID_Vanzari;
19 END IF;
20 RETURN c;
21 END vanzari_med;
22 /
Function created.
SQL>
I am having division table with three row like
divsionId name
1 divA
2 divB
3 divC
and customertable like
custId Name divisionId
1 cust01 1
2 cust02 1
3 cust03 2
4 cust04 1
5 cust05 2
6 cust06 3
7 cust07 3
8 cust08 1
and user table like
userId uname password roleId divisionId
1 john *** 1 1
2 ravi *** 2 1
3 bush *** 2 2
4 sam *** 2 3
5 jasd *** 1 2
6 jas *** 2 2
7 jioa *** 2 3
8 saho *** 2 1
9 vija *** 1 1
roleId name
1 ADMIN
2 USER
when user try to login with three paramters like
{
"division" : "divA",
"uname" : "john",
"password": "****"
}
if user got successfully login, i will genrate JWT Token includes division,role,etc
#GetMapping("/listcustomers")
public List<Customers> getCustomers(){
return customerService.findAll();
}
In this scenario when the user try to access /listcustomers api from customers table he should get the list of customers who are matched with division Id logged in user and divisonId Of customer assigned division only, AND HE SHOULD NOT BE ABLE TO ACCESS OTHER DIVISION CUSTOMERS FROM ANY WHERE, This is how i am looking for outpoot, No were i got the solution, Please any one help me, and also there are many apis with division assigned objects, And ROLE base its working fine, but division wise i'm not getting,
I am using spring boot 2.0.0.Relaease, Java 8, Hibernate, JWT Authentication spring security
Assuming you created a jwt token, you can user Principal to get the username from the token. Then you define findByUsername which returns filtered customers for that user.
import java.security.Principal;
#GetMapping("/listcustomers")
public List<Customers> getCustomers(Principal principal){
String currentUser = principal.getName()
return customerService.findByUsername(currentUser );
}
Update
Original file is a text file that is in a form of
( record_id, element )
( 1 1 2 3 )
( 2 2 5 6 7 )
I used the following function to read input file:
sc.textFile(input)
and process it into the records array format below.
=========================================================================
Here is a sample an array in scala im working in
Records Array looks like below:
Array(Record_Id , Array(Element) )
( 1 , Array(1,2,3 ) )
( 2 , Array(2,5,6,7) )
....
I wrote a scala map function to extract prefix(dynamically in here i take first half of the elements) of each array
val prefix = records.map(x => ((x._1, x._2) ,(x._2.take((x._2.size*0.5).ceil ))) )
Which will give me
Array(Record_Id , Array(Element) , Prefix)
( 1 , Array(1,2,3 ) , Array(1,2))
( 2 , Array(2,5,6,7) , Array(2,5))
....
Now I try to generate a RDD that uses each prefix as key, Which would look like something like this:
(Prefix , Array(Record_Id , Array(Element) )
( 1 , (1 , Array(1,2,3 ) )
( 2 , (1 , Array(1,2,3 ) )
( 2 , (2 , Array(2,5,6,7) )
( 5 , (2 , Array(2,5,6,7) )
....
I tried the following:
val pairedWithKey = prefix.map{case (k,v) => v.map(i => k ->i)}
It works perfectly on small volume data.
However, once i use this in a larger datasets it will take forever to load.
I'm still new to scala, it would be great if anyone can direct me on how to improve the performance of this operation.
I have a file,
ID,DNS,R_D,R_A
1,123456,2014/11/17,10
2,987654,2016/05/20,30
3,434343,2017/08/01,20
that I'm trying to load to oracle using External Tables. I have to skip the header row and also load the date column.
This is my query:
DECLARE
FILENAME VARCHAR2(400);
BEGIN
FILENAME := 'actual_data.txt';
EXECUTE IMMEDIATE 'CREATE TABLE EXT_TMP (
ID NUMBER(25),
DNS VARCHAR2(20),
R_D DATE,
R_A NUMBER(25)
)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY USER_DIR
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY '',''
MISSING FIELD VALUES ARE NULL
SKIP 1
(
"ID",
"DNS",
"R_D" date "dd-mon-yy",
"RECHARGE_AMOUNT"
)
)
LOCATION (''' || FILENAME || ''')
)
PARALLEL 5
REJECT LIMIT UNLIMITED';
END;
I get following exception:
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "skip": expecting one of: "column, exit, (,
reject"
KUP-01007: at line 4 column 5
ORA-06512: at "SYS.ORACLE_LOADER", line 19
I'm using sqlplus.
Could some oracle veterans please help me out and tell me what I'm doing wrong here? I'm very new to oracle.
You don't want to create any kind of tables (including external ones) in PL/SQL; not that it is impossible, but it is opposite of the best practices.
Have a look at my attempt, based on information you provided - works OK.
SQL> alter session set nls_date_format = 'dd.mm.yyyy';
Session altered.
SQL> create table ext_tmp
2 (
3 id number,
4 dns varchar2(20),
5 r_d date,
6 r_a number
7 )
8 organization external
9 (
10 type oracle_loader
11 default directory kcdba_dpdir
12 access parameters
13 (
14 records delimited by newline
15 skip 1
16 fields terminated by ',' lrtrim
17 missing field values are null
18 (
19 id,
20 dns,
21 r_d date 'yyyy/mm/dd',
22 r_a
23 )
24 )
25 location ('actual_data.txt')
26 )
27 parallel 5
28 reject limit unlimited;
Table created.
SQL> select * from ext_tmp;
ID DNS R_D R_A
---------- -------------------- ---------- ----------
1 123456 17.11.2014 10
2 987654 20.05.2016 30
3 434343 01.08.2017 20
SQL>
In my case skip 1 didn't work even with placing it between records delimited by newline and fields terminated by ',' lrtrim until I used load when. Now skip 1 works with the following access parameters:
access parameters (
records delimited by newline
load when (someField != BLANK)
skip 1
fields terminated by '','' lrtrim
missing field values are null
reject rows with all null fields
)
I'v got the following query:
SELECT
nr
, txt = info.result
FROM
dbo.anlagen AS a
CROSS APPLY
ocAuxiliary.splitString(
ISNULL(
ocAuxiliary.parseRTF(a.notiz)
,'')
,80)
AS info
which works fine on on database, but not on another. The functions / SPROCS are created by code and therefore deterministic.
Error on B is:
Meldung 102, Ebene 15, Status 1, Zeile 9
Falsche Syntax in der Nähe von '.'.
( Wrong Syntax near '.'.)
Just calling the used functions/SPROCS works fine also:
On DB A
SELECT * from ocAuxiliary.splitString('1234567890', 3)
returns
iteration result
1 123
2 456
3 789
4 0
as it does on DB B.
On DB A
select ocAuxiliary.parseRTF('{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\lang1031\fs20 12 ')
returns 12
as it does on DB B.
I simply don't see the mistake.