Tag Archives: SQL

SQL 2005 remote connection error (provider: SQL network interface, error: 28 – the server does not support the requested protocol

Solution: On the server side: Open SQL2005 SQL Server Management Studio program
(1) to connect to the database,
(2) trying to choose the registered under the menu Server
if there are no things out of the window, to update the local Server database engine right click on the select register
(3) on the local hope remote access database, right click on the select SQL Server configuration manager
(4) in the window, Select SQL Server 2005 network configuration in the left tree, select the appropriate database in the sub-set,
(5) and right click on TCP/IP in the right protocol to enable it
I followed this method to do first, and then found that it was still unable to connect to the server, finally use the following method to solve: start — “program –” Microsoft SQL Server 2005–& GT; SQL Server 2005 Peripheral Application Configurator select “Peripheral Application Configurator for Services and Connections” in this SQL server instance select Database Engine -& GT; For remote connections, select both TCP/IP and Named Pipes in the box on the right for local and remote connections

Error when connecting to database: DB2 SQL error: sqlcode = – 204, sqlstate = 42704, sqlerrmc= YXUAT.CUST_ BLK_ REL, DRIVER=4.25.13

DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC= yxuat. CUST_BLK_REL, DRIVER=4.25.13

Reason: When using MyBATIS, the remote database was connected, and the login user did not specify which schemas to use, that is, the user name was not specified. This led to the fact that Mybaits could not find the schemas we wanted, so it reported an error.
Solution 1: When you write SQL statements, you simply add schemas before the table names in the SQL
For example: SELECT * from cmis_uat1.cust_blk_rel
Solution 2: Add schemas when configuring datasource.
For example: spring: a datasource: url: JDBC: db2:// 10.10.0.36:50000/HNCKC: currentSchema = CMIS_UAT1; username: yxuat password: xfjr2016

DB2 create table error – 104 42601 illegal symbol encountered in SQL statement

Use PowerDesigner to design the database table, put the SQL statement generated by it into DB2 for execution, and report an error: an invalid symbol was encountered in the 104 42601 SQL statement
Some SQL statements are as follows:
create table user
(
UserId int the not null,
The username varchar null,
Hobby varchar null,
Constraint PK_USER primary key clustered (userId)
);
Upon verification, it was found that the above SQL statement set the field to NULL, which cannot be written in DB2.

SQL Server 2005, unable to log in, forget sa password, 15405 error!


can not be connected to./SQLEXPRESS.
Additional information:
user ‘sa’ login failed. This user is not associated with a trusted SQL Server connection. (18452), Microsoft SQL Server Error:)
— — — — — — — — — — — — — — — — — —
it’s mapping times wrong:
failed to create for user “sa”. (Microsoft) is essentially) express. The smo)
Additional information:
perform Transact_SQL statements or abnormal happened when the batch. (Microsoft) is essentially) express. ConnectionInfo)
unable to use special groups’ sa ‘. The (15405), Microsoft SQL Server Error:

2, the concrete solving steps:

the first step: open the SQL2005 with administrator login first, then right-click the selected attributes in the service name & gt; Security & gt; The login mode option on the right has been changed to authentication OK!

step 2: select safety (expand)> Login name & gt; Double-click the sa> Password change the password you need to confirm! Then turn off SQL2005 or disconnect.

. Step 3: start > Application & gt; Choose SQL2005 & gt; Configuration tool & GT; Open the configuration manager> Expand SQL Server2005 network configuration
note: select MSSQLSERVER if SQMEXPRESS
> TCP/IP options & gt; Enable and right click > Property & gt; Ip address TAB & GT; Change all disabled options to enabled & GT; Then restart the SQL2005 service!

SQL Server import MDF and LDF files appear: unable to open physical file “D:\ XX.mdf “。 Operating system error 5: “5 (access denied. )”Solutions

Right click on one of the databases in SQL Server Management Studio, select “New Query”, and run:

EXEC  sp_attach_db  @dbname  =  'store',     
@filename1  =  'D:\XX.mdf',     
@filename2  =  'D:\XX_log.ldf'

Press F5 or run button to execute.
Console output: appears
Unable to open physical file “D:\XX. MDF “. Operating system error 5:”5(access denied). ”

error log information:
Setting database option MULTI_USER to ON for database store.
Starting up database ‘store’.
error: 17204, severity: 16, status: 1.
FCB::Open failed: Could not Open file D:\store\store. MDF for file number 1. OS error: 5(denied access)
error: 17204, severity: 16, status: 1.
FCB::Open failed: Could not Open file D:\store\store_log.ldf for file number 2. OS error: 5(denied access)
error: 5105, severity: 16, status: 1.
A file activation error occurred. The physical file name’d :\store _store_log.ldf may be pen. account and correct additional errors, and retry The operation.
error: 928, severity: 20, status: 1
During upgrade, database raised exception 945, database raised exception 14, state 2, address 00000000009F3BD7. Use the exception number to determine the cause.

Solutions:
In the directory where the database resides, the folder where the MDF and LDF files are stored, right-click the folder — properties — security — Add the SqlServer service startup account or Everyone — check the box “Complete Control” — to exit.

Finally, rerun the above code.

SQL Server 2012 installation exception: error while enabling windows feature: netfx3, error code: – 2146498298

1. Installation environment
OS: Windows 2012 R2
SQL: SQL Server 2012
 
2. Fault description

 
3. Troubleshooting
It was found that the problem was due to the.net Framework 3.5 not being installed. .net 4.0 is out now, need to install.net 3.5?Sweat, it should be compatible! Here is the installation process.

 
Select the next step in the selection of the server to be installed, as shown below

Select the next step, go to the function module, and check the.NET Framework 3.5. Here you must select the alternate source path and specify the location of the installation file, as shown in the figure below.
 

 
The installation is complete

【ERROR_2】Call to a member function bind_param() on a non-object

When I was using MySQli prepared today, I encountered the following error:
 
 
 
Fatal error: Call to a member function bind_param() on a non-object in …
 
The error statement for the report is:
$prepareQuery-> bind_param(“sssd”,$isbn,$author,$title,$price);
 
— Error reasons:
$query=”insert into boks values(?,?,?,?) “;
$prepareQuery=$db-> prepare($query);
$prepareQuery-> bind_param(“sssd”,$isbn,$author,$title,$price);
 
The name of the table Boks is wrong. It should be books
 
So: when encountering an error like this, you should double-check your SQL!

SQL Error: 1452, SQLState: 23000

There was a problem when I encountered the modulation code today, that is, After I deleted all the records of the database, I registered through the registration page of the front page.
But SQL Error: 1452, SQLState: 23000; Other errors are as follows:
[tomcat HTTP — – 5] WARN org. Hibernate. Engine. The JDBC. Spi. SqlExceptionHelper – SQL Error: 1452, SQLState: 23000
the 2017-03-31 12:27:35 [tomcat HTTP — – 5] WARN org. Hibernate. Engine. The JDBC. Spi. SqlExceptionHelper – SQL Error: 1452, SQLState: 23000
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper – Cannot add or update a child row: a foreign key constraint fails (`chatwork`.`user_role`, CONSTRAINT `FK_02dcca8f72554a62bdec8067a49` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`))
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper – Cannot add or update a child row: a foreign key constraint fails (`chatwork`.`user_role`, CONSTRAINT `FK_02dcca8f72554a62bdec8067a49` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`))
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch – HHH000315: Exception executing batch [could not perform addBatch]
2017-03-31 12:27:35 [tomcat-http–5] ERROR org.hibernate.engine.jdbc.batch.internal.BatchingBatch – HHH000315: Exception executing batch [could not perform addBatch]
org.springframework.dao.DataIntegrityViolationException: could not perform addBatch; SQL [insert into user_role (nickName, role_id) values (?, ?)] ; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not perform addBatch
This error occurs because the foreign key is null, so an error is reported. Because it’s a test database, there’s nothing important in it so I just delete the database and restart the project and create the table.
 
 
Solution: first check the relationship of their own table, can be set in the background through the set method, or directly in the database to add this foreign key; One more thing is not to delete the library!!

MySql ERROR CODE:1215 Cannot add the foreign key constraint

The reason why mysql cannot add foreign keys appears
1. The data type and data length of the associated columns of the two tables are inconsistent.
For example, vARCHAR (20) is in column A of Table A, and VARCHAR (25) is in column B of table B. In this way, A and B cannot form foreign key association relationship.
 
2, when creating tables, add ENGINE=InnoDB DEFAULT CHARSET= UTf8;
CREATE TABLE `A` (

) ENGINE=InnoDB DEFAULT CHARSET=utf8;
In this way, if the B table and A table to be associated with the foreign key, then create B table also add ENGINE=InnoDB DEFAULT CHARSET= UTf8;

SQL Error (3621): String or binary data would be truncated The statement has been terminated. */

The error occurred when writing to the SQLServer database is as follows:
SQL Error (3621): String or binary Data would be truncated The statement has been. */
Reason 2.
The length of the field definition in the database table structure is smaller than the actual length of the field content to be written to, so it cannot be written
Iii. Solutions
The table structure fields can be successfully written after the length has been changed