Tag Archives: database

[Solved] Daily further: database error: unknown column ‘model’ in ‘field list‘

  If you encounter this problem today, record that you have created this’ model ‘field in the database and used querywrapper to initialize the query,   And then I reported this mistake,     Then I go to the database to query with SQL statements executed by the system;   It turned out that it was still a mistake   1054 – Unknown column ‘model’ in ‘field list’   ,
After that, use “*”   To query can directly find the data;   The field “model” also exists,   I don’t know what this is,   But locate the problem, start to modify the field. Then there is no problem
Other tables I created have the ‘model’ field, but this problem does not occur
But this is still a question,   After reading the explanation of other blogs, I found that I didn’t have the answer I wanted

Hope to have big guys see trouble to teach younger brother, also hope in the future I can give myself a direct answer~

Wrong report

2021-06-10 09:52:09.327 [http-nio-8083-exec-2] ERROR o.jeecg.common.exception.JeecgBootExceptionHandler:57 - 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column 'model' in 'field list'
### The error may exist in org/jeecg/modules/scw/scwEquipment/mapper/EquipmentMapper.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT  id,create_by,create_time,update_by,update_time,ip_address,housen_no,house_name,date_time,temp_data,max_num,min_num,aver_num,outhumi_data,inhumi_data,outtemp_data,intemp_data,status,model  FROM scw_equipment     WHERE (housen_no = ?) ORDER BY date_time DESC
### Cause: java.sql.SQLSyntaxErrorException: Unknown column 'model' in 'field list'
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column 'model' in 'field list'
org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: Unknown column 'model' in 'field list'
### The error may exist in org/jeecg/modules/scw/scwEquipment/mapper/EquipmentMapper.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT id,create_by,create_time,update_by,update_time,ip_address,housen_no,house_name,date_time,temp_data,max_num,min_num,aver_num,outhumi_data,inhumi_data,outtemp_data,intemp_data,status,model  FROM scw_equipment     WHERE (housen_no = ?) ORDER BY date_time DESC
### Cause: java.sql.SQLSyntaxErrorException: 
    Unknown column 'model' in 'field list'; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Unknown column 'model' in 'field list'
	............(useless information in the middle is omitted)
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'model' in 'field list'
    ............(useless information in the middle is omitted)

Then I go to the database and query with the SQL statement executed by the system

It turned out to be a mistake   1054 – Unknown column ‘model’ in ‘field list’

After that, use “*”   To query, you can directly find the data. This field “model” also exists,

Other tables I created have the ‘model’ field, but they can be found directly

ModuleNotFoundError: No module named ‘MySQLdb‘

Install MySQL client to solve!

Install the following dependent packages in order

================================

yum install mysql-devel

yum install gcc

yum install python3-devel

pip3 install mysqlclient

================================
the two methods found before
install MySQL connector Python
or pymysql.install_ as_ Mysqldb ()
doesn’t work for me. If I use it, there will be other errors

[Two Methods] Ora-00904: invalid group by error identifier

I believe many students encounter the problem of invalid prompt identifier when using group by. Don’t worry, let’s summarize the common solutions to this problem:

Example: take the information of the youngest employee in each department
my SQL statement is as follows:

select name,min(age),(select deptname from dept d where d.deptid=uif.deptid)deptname from userinfo uif group by name,deptname

When you click execute, the system prompts:

ORA-00904:"deptname":Identifier is invalid

Error reason: the field after group by cannot be an alias (if you want to use an alias, you need to nest it at one level)

Solution 1:

--goup by The department name (alias: deptname ) is directly used in the deptid field of the employee information table
select name,min(age),(select deptname from dept d where d.deptid=uif.deptid)deptname from userinfo uif group by uif.name,uif.deptid

Solution 2:

--Grouping after one level of nesting
select us.name,min(us.age),us.deptname from (select name,age,(select deptname from dept d where d.deptid=uif.deptid)deptname from userinfo uif)us
group by us.name,us.deptname

How about this time?If you have any questions, please leave a message to study together~

Ubuntu ODBC MySQL 8 OPTION NOT Work [How to Solve]

Error due to FreeSWITCH using ODBC requirements
If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS

# vim /etc/odbc.ini
[freeswitch]
Driver = MySQL
SERVER = localhost
PORT = 3306
DATABASE = myDatabase
OPTION = 67108864

Note: option = 67108864   Start SQL batch, freeswitch   ODBC mode must be on

ODBC does not configure SQL preprocessing, resulting in an error when executing multiple SQL statements at the same time

ubuntu20.04

Download and install ODBC driver from MySQL website

Note that the version option of 8x is invalid after setting,

Solution demotion

mysql-connector-odbc-5.3.14-linux-ubuntu19.10-x86-64bit.tar.gz

Verification supports preprocessing methods, which are not described here for ODBC configuration

isql -v freeswitch

delete from sip_ registrations where sub_ host is null and hostname=’VM-0-13-ubuntu’ and network_ ip like ‘%’ and network_ port like ‘%’ and sip_ u

Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe

mysql: [ Warning] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe:   ignoring option  ‘–
Before opening MySQL, it was normal. After entering the password today, it has been flashing back. The warning is as follows:

mysql: [ Warning] C:\Program Files\MySQL\MySQL Server  8.0\bin\mysql.exe:   ignoring   option  ‘– no-beep’   due   to   invalid   value  ‘’.**

terms of settlement:

Open the above path (my computer is like this, the default path, if your path is not the same, it is recommended to find the installation path), find my.ini file, it is recommended to save a copy before changing to prevent modification errors. Open it in Notepad and find the following statement:

Delete the “=” in the red underlined statement and click save.

Reopen the MySQL execution box. Generally speaking, 80% of the problem is solved successfully. However, if you still flash back, right-click to find the folder where MySQL is located and enter the. EXE file from the folder chart. I hope these will help you.

Record a problem of no module named ‘tensorflow. Examples’ and’ tensorflow. Examples. Tutorials’ in tensorflow 2.0

1: No module named ‘tensorflow. Examples’
I downloaded tensorflow directly from the Internet, which is version 2.5. The path to add examples is in C:// program data/anaconda3/envs/tensorflow/lib/site packages/tensorflow, which is similar to that on the Internet_ In the core folder, there is no such folder in version 2.5, so all the next operations are performed in site package/tensorflow.

First of all, you have to go to the official website of tensorflow( https://github.com/tensorflow/tensorflow/tree/master/tensorflow )Download the examples folder and copy it to the site package/tensorflow folder mentioned above. If you continue to run your code, there will be a problem of no module named ‘tensorflow. Examples. Tutorials’.

2: No module named ‘tensorflow. Examples. Tutorials’
in the site package/tensorflow folder, click the examples file you just copied in (I believe you have downloaded many tutorials files on the Internet, just copy them in directly), and then the code can run

Note: if you have not downloaded to the tutorials file, you can go to the official website of tensorflow, and then adjust the version to the version before 2.40, you will find the tutorials file in the examples folder (this method has not been tested, if it is feasible after the test, you can leave a message in the comments area, thank you).

Oracle can’t start the database due to deleting DBF file by mistake

Statement

First of all, this method can not recover the data. The purpose of this paper is to restore the database to normal, data can be discarded, mostly in the test environment.

Phenomenon

Delete the data file of the table space, resulting in an error when shutting down the database and the startup database, as follows:

SQL> startup;
ORACLE instance started.


Total System Global Area 4008546304 bytes
Fixed Size		    2259440 bytes
Variable Size		  872416784 bytes
Database Buffers	 3120562176 bytes
Redo Buffers		   13307904 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/data/oracle/oradata/orclstd/PSR1.dbf'

Because an 8K table space can only have a maximum of 32g, this table space specifies multiple DBF files, and several DBF files are deleted at one time. There is an operation [drop user XXX cascade;], Delete the user’s, and the table space does not exist, but [startup;] Database, or error. Use the following statement to close the data file:

SQL> alter database datafile '/data/oracle/oradata/orclstd/PSR1.dbf' offline drop;


Database altered.


SQL>  alter database open;
 alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/data/oracle/oradata/orclstd/PSR2.dbf'




SQL> alter database datafile '/data/oracle/oradata/orclstd/PSR2.dbf' offline drop;


Database altered.


SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 9 - see DBWR trace file
ORA-01110: data file 9: '/data/oracle/oradata/orclstd/psr1_02.dbf'




SQL>  alter database datafile '/data/oracle/oradata/orclstd/psr1_02.dbf' offline drop;


Database altered.


SQL> alter database open;


Database altered.


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.


Total System Global Area 4008546304 bytes
Fixed Size		    2259440 bytes
Variable Size		  872416784 bytes
Database Buffers	 3120562176 bytes
Redo Buffers		   13307904 bytes
Database mounted.
Database opened.
SQL> exit

If other dBfs affect the database startup, execute [alter database open;] When the error is detected, continue the cycle until no error is detected.

[Solved] com.alibaba.druid.pool.DruidDataSource – create connecti

A service deployed in the server docker reported the following error when connecting to the database:

I have searched a lot of information on the Internet, but I can’t solve it by trying various ways,
ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://10.10.20.16:3306/acs?&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Kolkata, errorCode 0, state 08S01
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

The specific error information is as follows:

ERROR com.alibaba.druid.pool.DruidDataSource – create connection SQLException, url: jdbc:mysql ://10.10.20.16:3306/acs?& amp; useUnicode=true& characterEncoding=UTF-8& zeroDateTimeBehavior=convertToNull& allowMultiQueries=true& serverTimezone=Asia/Kolkata, errorCode 0, state 08S01
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

Cause of error:

It may be due to the different versions of JDK. This error message is probably caused by the SSL protocol of MySQL

solution: I tried to remove SSLv3 from java.security in jdk-8 on my local machine and restart the service, but I still couldn’t solve it
finally, add this to the MySQL connection string in the service configuration; Usessl = false, that is, disable SSL, problem solved

The COMMIT TRANSACTION request has no corresponding BEGIN

Background

Error thrown when inserting data into SQL Server database using Python:

Cannot commit transaction: (3902,b'The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
DB-Lib error message 20018, severity 16:\nGeneral SQL Server error:Check messages from the SQL Server\n')

analysis

Well, there’s no reason. But a solution was found by accident.

solve

The error caused by the field type in sqlserver. The error I encountered is: one of the fields is set to date type. When inserting data, I report an error. Change the date type to varchar type, the problem is solved, and the data is inserted normally.

Summary

The varchar type may affect the data usage. Solve the problem first, and then solve the problem later. I think that inserting varchar data into the database is the most stable (personal experience).


Personal ability is limited, if there is a mistake welcome to correct!