Tag Archives: database

Database App.config configurate file Error & Solution

Error message 1

Object reference is not set to an instance of the object.

Error Message:

[Problem Analysis]: Open the App.config file, check the string in the name node and the current brackets is the same, the comparison found, not the same, more than one S. Remember, C# reads the name in brackets used in the node, and the configuration file node configuration name must be consistent!

Solution

[problem-solving] remove “s” and run it.

[other Error] 1: some friends don’t pay attention to this situation that you add spaces in the string will also lead to this problem, such as the following:

Spaces must be removed. You cannot add any spaces in the configuration file.

[other Error] 2: if the node position is written incorrectly, the above error will also occur. For example, in the screenshot below, the node should be written to the arrow position.

[other Error] 3: If the App.config configuration file is not added, or the App.config file is not placed in the project launchable project directory, the above error will also occur. For example, the following is wrong:

The following green part is the project’s startable items, App.config file must be put here to work.

[Other Error] 4: modified the name of the configuration file, the configuration file requirements must be the default App.config to work, if you modify the file name, there will also be errors, such as the following is not allowed: the case of.

 

Error message 2

The type initial value setting item of “ThreeLayer.DAL.SQLHelper” raises an exception.

Error Message:

The problem is that as long as the prompt “SQLHelper’s type initial setting item raises an exception”. Generally, it is a configuration file problem, because we use App.config configuration file to save the data connection string. For beginners, because they can’t understand this error, so they don’t know where to start, here please remember the following troubleshooting methods.

Solution
[Solution 1] The configuration file node is written wrong

Originally this place node name is also the above is less than an s, change to the following can be: [Solution 2] configuration file App.config file if you change the name, not placed in the “startable project” root directory.

[Solution 2] configuration file App.config file if the name is modified, not put into the “startable project” root directory, some VS versions will also appear the above error. (This is the same as the solution to error 1)

Summary
According to the above method, you can perfectly solve the common problem of getting the connection string through App.config. I hope today’s content can help you.

[Solved] DLL load failed while importing _sqlite3: the specified module could not be found.

In the anaconda environment, pysqlite3 is installed:

pip install pysqlite3

But an error is reported:

DLL load failed while importing _sqlite3: the specified module could not be found.

The DLL file is missing. Go to the official website to download the DLL compressed package of the corresponding system version

Copy sqlite3.dll to the DLLs directory under Anaconda and it’s solved.

[Solved] EOS7.6 Error: Init DB failed [Specified key was too long; max key length is 767 bytes…

Init DB failed![Specified key was too long; max key length is 767 bytes[CREATE INDEX IDX_WFWI_PARTICI ON WFWORKITEM( PARTICIPANT )]
Specified key was too long; max key length is 767 bytes[CREATE INDEX WTRI_EXPAT ON WFTASKRESOURCEINFO(EXCLUDEUNIQUEID)]
Specified key was too long; max key length is 767 bytes[CREATE INDEX WTRI_COMP ON WFTASKRESOURCEINFO(QUEUENAME,STATUS,SERVERID)]
]


– select 'yes' for retry and' no 'for exit

 

If the system variable innodb_large_prefix is enabled (enabled by default, it is off by default on my computer installation of MySQL 5.6.41, and on by default on MySQL 5.7), the index key prefix is limited to 3072 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format. If innodb_large_prefix is disabled, the index key prefix is limited to 767 bytes for any table in row format.

innodb_large_prefix will be removed and deprecated in future releases. The innodb_large_prefix was introduced in MySQL 5.5 to disable large prefix indexes for compatibility with earlier versions of InnoDB that did not support large index key prefixes.

For InnoDB tables using REDUNDANT or COMPACT row formats, the index key prefix length is limited to 767 bytes. For example, you might reach this limit using a column prefix index of more than 255 characters on a TEXT or VARCHAR column, assuming a utf8mb3 character set and a maximum of 3 bytes per character.

Attempts to use an index key prefix length that exceeds the limit will return an error. To avoid such errors in replication configurations, avoid enabling enableinnodb_large_prefix on the master server (if it cannot be enabled on the slave server).

The restrictions that apply to index key prefixes also apply to full column index keys.

Note: The above is 767 bytes, not characters, specifically the number of characters, which is related to the character set. gbk is double-byte, utf-8 is triple-byte

Solutions.

1: Enable the system variable innodb_large_prefix
Note: It is not enough to have this system variable enabled. The following conditions must be met.

2: System variable innodb_large_prefix is ON

3: System variable innodb_file_format is Barracuda

4: ROW_FORMAT is DYNAMIC or COMPRESSED

mysql> show variables like '%innodb_large_prefix%';
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| innodb_large_prefix | OFF   |
+---------------------+-------+
1 row in set (0.00 sec)

mysql> set global innodb_large_prefix=on;
Query OK, 0 rows affected (0.00 sec)
 
mysql> show variables like '%innodb_file_format%';
+--------------------------+----------+
| Variable_name            | Value    |
+--------------------------+----------+
| innodb_file_format       | Antelope |
| innodb_file_format_check | ON       |
| innodb_file_format_max   | Antelope |
+--------------------------+----------+
3 rows in set (0.00 sec)

mysql> set global innodb_file_format=Barracuda;
Query OK, 0 rows affected (0.00 sec)

mysql> set global innodb_file_format_max=BARRACUDA;
Query OK, 0 rows affected (0.01 sec)

After completing the above operations, EOS platform 7.6 is successfully installed.

[Solved] JAVA Operate Database Error: You have an error in your SQL syntax; Dao layer SQL statement error

JAVA Operate Database Error: You have an error in your SQL syntax; Dao layer SQL statement error

Specific error reports are as follows:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?,?)' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.Util.getInstance(Util.java:408)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
	at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1552)
	at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2607)
	at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1480)
	at cn.edu.wut.jwms.dao.TeacherDao.insertTeacher(TeacherDao.java:39)
	at cn.edu.wut.jwms.testDao.testTeacherInsert(testDao.java:14)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Error reporting location code:

public boolean insertTeacher(Teacher teacher)  {
        boolean b = false;

        try {
            //get the connection
            Connection connection = JDBCUtil.getConn();

            String sql = "INSERT INTO tb_teacher(teacher_num,teacher_pwd,teacher_name,teacher_tel,teacher_col_id) VALUES(?,?,?,?,?)";
            //compile
            PreparedStatement ps = connection.prepareStatement(sql);

            //Assigning values to placeholders
            ps.setString(1,teacher.getTeacherNum());
            ps.setString(2,teacher.getTeacherPwd());
            ps.setString(3,teacher.getTeacherName());
            ps.setString(4,teacher.getTeacherTel());
            ps.setInt(5,teacher.getTeacherColId());

            int i = ps.executeUpdate(sql);//Number of rows affected by the update operation on the data

            b = i>0?true:false;

            //close the connection
            connection.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return b;
    }

Process: check the SQL statements for many times and no errors are found. The test data is also checked for many times to confirm that the rules formulated during table creation are met;

Result.

int i = ps.executeUpdate(sql); because in this code, pass in the sql statement again to report an error, modified to
int i = ps.executeUpdate();; after the error is resolved.
Reason: The sql statement has already been passed in when the compile operation is executed, so it does not need to be passed in again when it is executed.

[Solved] tidb-cdc Create Task Error: Unknown or incorrect time zone

1. Error reporting details

fail to open MySQL connection: [CDC:ErrMySQLConnectionError]Error 1298: Unknown or incorrect time zone: 'Asia/Shanghai'

2. Troubleshooting

# Login tidb and check the time zone
show variables like '%time_zone%';
+------------------+---------------+
| Variable_name    | Value         |
+------------------+---------------+
| system_time_zone | Asia/Shanghai |
| time_zone        | SYSTEM        |
+------------------+---------------+
# login mysql and check the time zone
show variables like '%time_zone%';
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | CST    |
| time_zone        | SYSTEM |
+------------------+--------+

It can be found that the time zone of the upstream tidb is North America/USA, while the time zone of the downstream MySQL is CST

3. Solution

Method 1: load the time zone

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p

Method 2: write sink to upstream and downstream time zones

cdc cli changefeed create --sink-uri="mysql://user:password@mysql_ip:mysql_port/?time-zone=CST" --pd=http://pd_ip:pd_port

[Solved] TDengine Error: Unable to resolve FQDN

TDengine Error: Unable to resolve FQDN

Project scenario:

Win10 using Python link tdengine to read the database

Problem description

Problems encountered in the Project:

Unable to resolve FQDN is reported when the code reads the contents of the database

# connect the database of taos
conn = taos.connect(host=ip, user=user, password=pwd, database=db_database)
cursor = conn.cursor()
cursor.execute('select * from sensor_data')

Solution:

In the server, find the contents under the/etc/hosts file, copy them to the local file C:\Windows\System32\drivers\etc\hosts, and rerun the code

[Solved] CentOS Start Neo4j Database Error: Error: A JNI error has occurred, please check your installation and try again

CentOS Start Neo4j Database Error: Error: A JNI error has occurred, please check your installation and try again

This is because when installing neo4j, it comes with:

java-11-openjdk-headless-11.0.15.0.9-2.el7_9.x86_64
java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64

This is caused by a conflict with the version of JDK previously installed on the server

So now you just need to uninstall all JDK versions and reinstall neo4j
check the existing JDK

rpm -qa | grep jdk

Uninstall all jdks (it’s easy to uninstall some files in CUDA, but it doesn’t affect deep learning and GPU training model)

yum -y remove(Uninstall all the packages that appear above)

Reinstall neo4j

sudo yum install neo4j

[Solved] Error Code: 2013. Lost connection to MySQL server during query

Error Code: 2013. Lost connection to MySQL server during query

Today, when using the official MySQL graphical tool mysqlworkbench to query the view, this error is reported:
error code: 2013 Lost connection to MySQL server during query

If the disk is not full, you can use the following method:

Modify the timeout in the red box. The default is 10 seconds. If the table data is too large and the query time is too long, the above error will be returned.

[Solved] MongoDB Update User Error: Error: not authorized on admin to execute command

MongoDB Update User Error: Error: not authorized on admin to execute command

background

The thing is this: MongoDB weak password vulnerability and high risk, the password must be changed!
Environment: windows, the database is open authentication

report errors

Log in to the database and execute:

use admin
db.changeUserPassword('admin','123456');

report errors:

[Error] Error: not authorized on admin to execute command

Solution:

1. Close mongodb service (Windows service, registered)
2. Start the service without identity authentication:

mongod --dbpath=dbpath

3. Open new CMD

mongo
use admin
db.changeUserPassword('admin','123456');

Normal
4. Restart mongodb service

[Solved] eggjs Error: Warning: Current Server Discovery and Monitoring engine is deprecated, and will be rem…

eggjs error: Warning: Current Server Discovery and Monitoring engine is deprecated, and will be rem…

Errors are reported as follows:

Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor

 

 

Cause of error reporting:

Mongoose the old parser is going to be discarded and the new parser should be used

Solution:

Add a configuration in the directory config/config.default.js:

	config.mongoose = {
	    url: 'mongodb://127.0.0.1:27017/userLog',
      options: {
         useUnifiedTopology:true
      },
	};

How to Solve Error: Rsa Public Key not Find

Error: Rsa Public Key not Find

Navicat for MySQL is a graphical tool for MySQL.

Resolve RSA public key not find

I found that the reason for this problem is that I didn’t put keyword under the installation path of graphical tools
solution: copy keygen to the installation directory of graphical tools.

No all pattern found! File Already Patched?

This prompt appears because you have previously registered with keygen on your computer and cannot re register
solution:
1 Use Win + R to input regedit instruction to edit the registry

2. Find HKEY in the registry_CURRENT_User\software\premiersoft, and delete the directory
3. Reinstall the graphical tool.

Registration steps

premise: do not open it after successful installation
1. Copy keygen to the installation directory of graphical tools
2. Select MySQL , click patch , and a registered patch will be generated in the installation directory
3. Click generate in the corresponding column of keyword to generate a serial number. At this time, first disable the network or disconnect the network , open the graphical tool, select register , fill in the serial number, click activate, and then select to activate manually
4. At this time, a string of request codes will be generated. Paste them into keyword , and click generate in the corresponding column of activation code to generate the activation code
5. Paste the activation code into the graphical tool, and the registration is successful.

[Solved] Red hat 7.9 install DM8 of Damon database and starting graphical error with xmanager enterprise 5

Red hat 7.9 install DM8 of Damon database and starting graphical error with xmanager enterprise 5

Error Messages:

[dmdba@dmdb01 dmsetup]$ ./DMInstall.bin 
Extract install files......... 
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    no swt-pi-gtk-3659 in java.library.path
    no swt-pi-gtk in java.library.path
    /tmp/swtlib-64/libswt-pi-gtk-3659.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
    Can't load library: /tmp/swtlib-64/libswt-pi-gtk.so
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:267)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
    at org.eclipse.swt.widgets.Widget.isValidSubclass(Widget.java:988)
    at org.eclipse.swt.widgets.Decorations.checkSubclass(Decorations.java:164)
    at org.eclipse.swt.widgets.Shell.<init>(Shell.java:258)
    at org.eclipse.swt.widgets.Shell.<init>(Shell.java:253)
    at org.eclipse.swt.widgets.Shell.<init>(Shell.java:204)
    at org.eclipse.swt.widgets.Shell.<init>(Shell.java:140)
    at com.dameng.common.gui.util.SWTUtility.canInitGUI(SWTUtility.java:380)
    at com.dameng.install.ui.MainApplication.run(MainApplication.java:80)
    at com.dameng.install.ui.MainApplication.main(MainApplication.java:436)
[dmdba@dmdb01 dmsetup]$

 

Solution:
This kind of error is graphics related with the missing rpm package error message, use find command to find the relevant rpm package also does not exist, you need to install additional.
Make sure the local yum source is properly configured or the network is kept open, enter the following command.
yum install gtk2 libXtst xorg-x11-fonts-Type1
[root@dmdb01 yum.repos.d]# yum install gtk2 libXtst xorg-x11-fonts-Type1
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Package libXtst-1.2.3-1.el7.x86_64 already installed and latest version
Resolving Dependencies
–> Running transaction check
—> Package gtk2.x86_64 0:2.24.31-1.el7 will be installed
—> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed
–> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch
–> Running transaction check
—> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed
—> Package xorg-x11-font-utils.x86_64 1:7.5-21.el7 will be installed
–> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.5-21.el7.x86_64
–> Running transaction check
—> Package libfontenc.x86_64 0:1.1.3-3.el7 will be installed
–> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================
Package                                 Arch                      Version                           Repository                      Size
==========================================================================================================================================
Installing:
gtk2                                    x86_64                    2.24.31-1.el7                     rhel-source                    3.4 M
xorg-x11-fonts-Type1                    noarch                    7.5-9.el7                         rhel-source                    521 k
Installing for dependencies:
libfontenc                              x86_64                    1.1.3-3.el7                       rhel-source                     31 k
ttmkfdir                                x86_64                    3.0.9-42.el7                      rhel-source                     48 k
xorg-x11-font-utils                     x86_64                    1:7.5-21.el7                      rhel-source                    104 k
Transaction Summary
==========================================================================================================================================
Install  2 Packages (+3 Dependent packages)
Total download size: 4.1 M
Installed size: 14 M
Is this ok [y/d/N]: y
Downloading packages:
——————————————————————————————————————————————
Total                                                                                                     120 MB/s | 4.1 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : ttmkfdir-3.0.9-42.el7.x86_64                                                                                           1/5
Installing : libfontenc-1.1.3-3.el7.x86_64                                                                                          2/5
Installing : 1:xorg-x11-font-utils-7.5-21.el7.x86_64                                                                                3/5
Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch                                                                                  4/5
Installing : gtk2-2.24.31-1.el7.x86_64                                                                                              5/5
Verifying  : xorg-x11-fonts-Type1-7.5-9.el7.noarch                                                                                  1/5
Verifying  : libfontenc-1.1.3-3.el7.x86_64                                                                                          2/5
Verifying  : 1:xorg-x11-font-utils-7.5-21.el7.x86_64                                                                                3/5
Verifying  : gtk2-2.24.31-1.el7.x86_64                                                                                              4/5
Verifying  : ttmkfdir-3.0.9-42.el7.x86_64                                                                                           5/5
Installed:
gtk2.x86_64 0:2.24.31-1.el7                                   xorg-x11-fonts-Type1.noarch 0:7.5-9.el7
Dependency Installed:
libfontenc.x86_64 0:1.1.3-3.el7            ttmkfdir.x86_64 0:3.0.9-42.el7            xorg-x11-font-utils.x86_64 1:7.5-21.el7
Complete!
[root@dmdb01 yum.repos.d]#
Start the installer again and it will display the graphical representation properly.