Author Archives: Robins

MySQL error 1451 23000 foreign key exception handling

Share my teacher’s artificial intelligence tutorial! Zero basis, easy to understand! http://blog.csdn.net/jiangjunshow

You are also welcome to reprint this article. Share knowledge, benefit the people, and realize the great rejuvenation of the Chinese nation!

               
 
 
 
1. Execute DELETE to report an error
mysql> delete from JBPM4_EXECUTION;
ERROR 1451 (23000): Cannot delete or updatea parent row: a foreign key constraint fails (`jbpm_db`.`JBPM4_EXECUTION`,CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES`JBPM4_EXECUTION` (`DBID_`))
mysql>
 
 
The table has a foreign key, so delete is wrong. Here are two ways to handle it:
(1) Temporary setting of foreign key failure
(2) Delete the table data of the foreign key involved in the table
 
 
 
2. Handling scheme of foreign key failure

mysql> SET FOREIGN_KEY_CHECKS = 0; # Temporarily set foreign key invalidation Query OK, 0 Rows affected (0.00 SEC) MySQL> Mysql> delete from JBPM4_EXECUTION; # Execute delete operation Query OK, 110 Rows Affected (0.00 SEC) MySQL> Mysql> SET FOREIGN_KEY_CHECKS = 1; After the # operation restore foreign keys Query OK, 0 Rows affected (0.00 SEC) MySQL>
 
 
3, delete the foreign key table data out of the scheme
 
First, query all the foreign key situations involved in table lock, and query THE SQL as follows:
The

SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME the FROM Information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME = ‘JBPM4_EXECUTION’; usage WHERE REFERENCED_TABLE_NAME = ‘JBPM4_EXECUTION’;

Executing the query will see the following foreign key:
E:\u\mysql\problem\pic\02.jpg

 
Then you see the tables that involve foreign keys are JBPM4_VARIABLE, JBPM4_EXECUTION, and JBPM4_SWIMLANE three tables, and then you can clear the data for these three tables.
 
The

mysql> delete from JBPM4_VARIABLE; Query OK, 1404 Rows Affected (0.03 SEC) MySQL> delete fromJBPM4_SWIMLANE; Query OK, 13 Rows Affected (0.03 SEC) MySQL> The delete from JBPM4_EXECUTION; ERROR 1451 (23000): Cannot delete or update a parent Row: Cannot delete or update a parent Row: Fails (‘ jbPM_DB ‘. ‘JBPM4_EXECUTION’, constraint ‘FK_EXEC_INSTANCE’ foreign key (‘ INSTANCE_ ‘) REFERENCES ‘JBPM4_EXECUTION’ (‘ DBID_ ‘)) mySQL> Mysql> The update JBPM4_EXECUTION set INSTANCE_ = null, PARENT_ = null, SUBPROCINST_ = null, SUPEREXEC_ = null; Query OK, 203 rows affected (0.02 SEC) Rows matched: 203 Changed: 203 Warnings: 0 MySQL> The delete from JBPM4_EXECUTION; All foreign key associated data has been cleared. Now delete the data. Query OK, 203 rows affected (0.02 SEC) MySQL>
            

Call my teacher’s artificial intelligence tutorial! http://blog.csdn.net/jiangjunshow

Error ts1005: ‘;’ expected

function sayHello(person: string) {
  return 'Hello, ' + person;
}

let user = 'Tom'
console.log(sayHello(user));

hello.ts
tsc hello.ts
An error

E:\source\develop\typescript\typescriptstudy\hello.ts(5,5): error TS1005: ';' expected.

The actual test found that changing let to var did not report the error.
the error message doesn’t say the wrong semicolon, it says the compiler can’t recognize the let keyword.
Running tsc-v
found version 1.0.3.0
Then I learned online that Typescript supports let syntax in 1.4. Just open the Windows environment variable and see where TSC is using the command, if the version is wrong.
The following statement is found in path within the Windows environment variable:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;
seems to be using the 1.0 that comes with the system.
Delete the environment variable here. Also delete Typescript 1.0 under the path. Let’s reinstall it

npm install -g typescript@latest

finally run:
tsc-v
found this time is not 1.0.3.0 but the latest installation 3.8.3. No problem.

Linux uses open source Yum to report error performing checksums

 
Now open source yum has USTC and 163. Repo file downloaded directly from the Internet, running will report an error, manually modified a bit:
 
Ustc yum is used, and the configuration file is as follows:
[root@web1 yum.repos.d]# cat ustc.repo
 
[base]
Name = CentOS – 5.9 – Base – mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/5.9/os/$basearch/
gpgcheck=0
enabled=1
 
#released updates
[updates]
Name = CentOS – 5.9 – Updates – mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/5.9/updates/$basearch/
gpgcheck=0
enabled=1
 
#additional packages thatmay be useful
[extras]
Name = CentOS – 5.9 – Extras – mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/5.9/extras/$basearch/
gpgcheck=0
enabled=1
 
Once configured, perform YUM Update, Error Performing Checksum
 
[root@web1 yum.repos.d]# yum update
Loaded plugins: katello, product-id,security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Base | 3.7 kB 00:00
The base/primary_db | 4.4 MB 00:02
http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2: [Errno – 3] Error performingchecksum
Trying other mirror.
The base/primary_db | 4.4 MB 00:02
http://mirrors.ustc.edu.cn/centos/6.4/os/x86_64/repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2: [Errno – 3] Error performing checksum
Trying other mirror.
Error: failure:repodata/1e584feac3f3fb76ad4b6fb7e1bc8d44fa124814e9d186dc913ded3c63a216b3-primary.sqlite.bz2from base: [Errno 256] No more mirrors to try.
 
 
Google says that the REPomd.xml file USES SHA256 as the hash algorithm in RHEL 6, and SHA as the hash algorithm by default in RHEL 5.
 
But I’m using yum with 5.9 on Redhat 5.8. This error also occurs.
 
The online solution is to use the new SHA1 to rebuild repo:
# createrepo -s sha1 dave-el5-x86_64
 
 
I did not create it here, but just execute the following command:
# yum clean all
 
 
And then it’s ok. Little knowledge, along with notes.
 
 
 
 
 
 
 
 
 
——————————————————————————————–
Copyright, the article is allowed to reprint, but must indicate the source address in the way of link, otherwise the legal responsibility!
QQ:492913789
Email:[email protected]
Blog: http://www.cndba.cn/dave
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware

Solution to error 1452: cannot add or update a child row: a foreign key constraint failures in MySQL

When executing a SQL query, I suddenly reported 1452, which made me totally confused.
In fact, the main reason for the error of 1452 is that there is no data in the main table corresponding to the child table with foreign keys.
For example:
Class list:
The

id

name

1

advanced classes

2

regular class
Student table:

id

name

class_id

1

* *

1

2

and

2

3

fifty

3
As a result, there is no data for the class with class_ID 3 for king 5 in the table.
So no matter how you do the update statement on king five he’s going to report an error.
 
The real reason:
 
I copied a “class list” from the official library, and then I copied a “student list”, and then I made a mistake in the operation of the student list.
Because after the class table was copied and before the student table was copied, new classes and students were added on the line. Then the data I copied here was only students, and no class was finished…
It’s embarrassing.
So don’t mess around…
 
Solution 1:
Clear both tables and redo them.
Solution 2:
Use SQL to delete data that has no data in the main table corresponding to the foreign key.
Take the above example: Delete Wang Wu.

Ie8.0 reports Oracle error 1403 error after logging into Oracle EBS

Internet Explorer 8.0 logged in Oracle EBS and reported an error. The login page opened without any problem, but entered the user name and password and logged in. The following error occurred:

< PRE> Oracle error 1403: java.sql.SQLException: ORA-01403: no data found ORA-06512: at line 1 has been detected in FND_SESSION_MANAGEMENT.CHECK_SESSION. Your session is no longer valid. < /PRE>

Servlet error: An exception occurred. The current application Deployment descriptors do not allow for including it in this response. Please consult The application log for details.

Trying to clear the cache and restart the browser, the login problem remains unresolved. (But with Firefox, login is normal).

Solution:
IE browser -> Tools – & gt; Internet options – & gt; “Advanced” TAB, remove the “enable third-party browser extensions” option, and close all IE browsers, try again, problem resolved.

samba Error NT_STATUS_CONNECTION_REFUSED Failed to connect with SMB1 — no workgroup available

Error connecting to a colleague’s Shared service:
Smbclient-l ip-u user
WARNING: The “syslog” option is deprecated
Enter WORKGROUP\administrator’s password:
Sharename Type the Comment
— — — — — — — — — — — — — — — — —

XXX XXX Disk remote management Shared Disk default IPC remote IPC

XXX XXX Disk Logon server share
XXX Disk Logon server share
share_dir Disk
Reconnecting with SMB1 for workgroup listing.
Connection To IP failed (Error nt_status_connection_union)
failed to connect with SMB1 — no workgroup available
 
The problem was located for a long time, and finally it was found that the problem could be ignored and accessed directly by using the following instructions:
The smbclient// IP/share_dir -u administrator

[Python] urlerror: < urlopen error timed out > error

These days when I do crawler with Python, I always encounter Python URLError: < urlopen error timed out> The more threads open, the more frequently they occur. Later proved that the program did not have a problem, checked the information on the Internet, the network is blocked, more than a few times to try it.  
For example, the original code looks like this:

if headers:
		req=urllib2.Request(url,headers=headers)
	else :
		req=urllib2.Request(url)
	opener=urllib2.build_opener(cookieproc)
	urllib2.install_opener(opener)
	page=urllib2.urlopen(req,timeout=5).read()

can be changed after adding a loop:

if headers:
		req=urllib2.Request(url,headers=headers)
	else :
		req=urllib2.Request(url)
	opener=urllib2.build_opener(cookieproc)
	urllib2.install_opener(opener)
	global Max_Num
	Max_Num=6
	for i in range(Max_Num):
		try:
			page=urllib2.urlopen(req,timeout=5).read()
			break
		except:
			if i < Max_Num-1:
				continue
			else :
				print 'URLError: <urlopen error timed out> All times is failed '

This exception can generally be resolved

configure: error: C++ preprocessor “/lib/cpp” fails sanity check

The following error occurred while installing TigerVnc for Ubuntu 10.04.3 LTS

checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.

This is due to the lack of appropriate libraries, so it can occur on different systems and when installing different software.
Since there is no corresponding library, the solution is simple and the corresponding library can be installed.
Here is one of the results I found. It reads as follows:
/lib/ CPP fails to solve puzzles check
When you run./configure, you’ll get an error:
Configure: error: C++ preprocessor “/lib/ CPP” fails sanity
check See ‘config.log’ for more details
Solution: this situation occurs because the relevant package of the c++ compiler is not installed. Log in as root and execute on the terminal:
# yum install glibc-headers
# yum install gcc-c++
This comrade USES the red hat version, for Ubuntu, just change yum to apt-get.
 
But I didn’t use this method myself, because Build-Essential contains a lot of base libraries, so I decided to give it a try and type

#sudo apt-get install build-essential

Run./configure again
This approach is recommended because it contains a number of basic libraries and may save you the trouble of missing libraries when you already have other software installed.

MySQL error: can’t create table ‘..’( errno:150 )Solutions

scenario
Student table S (SNO, SNAME, SAGE), class schedule C (CNO, CNAME)
When the course selection table (SC) is created, set (SNO, CNO) as the primary key and SNO and CNO as the foreign keys

drop table if exists sc1;
create table sc1(
    sno varchar(10),
    cno varchar(10),
    grade numeric,
    primary key(sno,cno),
    foreign key(sno) references s(sno),
    foreign key(cno) references c(cno)
);

Error warning:

The solution
1. Check whether the types and sizes of foreign key fields in SC table are exactly the same as those in S table C table
2. One of the foreign keys you are trying to reference has no index or is not a primary key. If one of the foreign keys is not a primary key, you must create an index for it.
3, one or two tables are MyISAM engine table, if you want to use foreign key constraints, must be InnoDB engine

The error of the author is that cNO is not set as primary key in Table C, which can be solved by setting it once

mysql error 1093

Error Code: 1093. You can’t specify target table ‘t_user’ for update in FROM clause 0.015 SEC
data cannot be query in the same table as update data in the same table.
note that this problem occurs only in mysql; MSSQL and oracle do not.
Keyword search: mysql Error 1093
Example:


delete from t_user where id in (select id from t_user where id > 26);
Error Code: 1093. You can’t specify target table ‘t_user’ for update in FROM clause 0.000 SEC

Solution: select the result of the select through the intermediate table again, so as to avoid the error
change the SQL statement to:

delete from t_user where id in (select * from (select id from t_user where id > 26) tmp);

Then optimize it:

delete t from t_user t join (select id from t_user where id > 22) tmp on tmp.id = t.id;

query data in the same table as the same table update or delete delete, the SQL statement is as follows:
select * from (clause temp)