Tag Archives: database

About the cause of the long-standing ADO error: unspecified error “(error code = 0x80004005) (excerpt from the Internet)

ms-help://MS.MSDNQTR.2005APR.1033/enu_kboledb/oledb/251254.htm
SYMPTOMS
When trying to connect to an Access .mdb file, an ODBC error is returned stating “Disk or Network Error”. The Microsoft OLE DB Provider for the Microsoft Jet database engine may also return an “Unspecified error” (error code = 0x80004005) message.

The problem can occur only when the data source is opened under the Microsoft Internet Information Server (IIS) or a Microsoft Windows NT service but not under a logged-on user account.
CAUSE
Jet creates a temporary file when the engine is started. In doing so, it first checks the TMP environment variable and uses that path to define where the temporary file is created. If it doesn’t see a TMP environment variable, it looks for the TEMP environment variable. If TEMP is not defined, it then uses the Windows folder (/WINDOWS or /WINNT).

If TMP/TEMP is defined but points to a nonexistent folder, the error occurs.

Moreover, when opening the Access database through IIS or a Windows NT service, and when IIS or the service is running under the local system account, the TMP or TEMP system environment variable is used. When the Web services or Windows NT service are started using a user account, the TMP/TEMP user profile environment variables is used.
 
RESOLUTION
Define a TMP or TEMP environment variable and assign the variable to an existing folder. If you are accessing the Access database from IIS, be certain to check the system environment settings rather than environment variables of the logged-on user. Also ensure that the IUSER anonymous IIS account has access to the temporary folder.

You must restart the computer after changing any environment variables.
Environment variables are set under Windows NT 4.0 by going to the Control Panel and clicking System and then selecting the Environment tab.

C programming interface of SQLite database (6) result codes and error codes

SQlite database C programming interface (VI) Result Codes and Error Codes by QQ: 253786989 2012-02-07

Standard Codes
Here are the standard return values and error code definitions:

#define SQLITE_OK           0   /* Successful result */
/* beginning-of-error-codes */
#define SQLITE_ERROR        1   /* SQL error or missing database */
#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
#define SQLITE_PERM         3   /* Access permission denied */
#define SQLITE_ABORT        4   /* Callback routine requested an abort */
#define SQLITE_BUSY         5   /* The database file is locked */
#define SQLITE_LOCKED       6   /* A table in the database is locked */
#define SQLITE_NOMEM        7   /* A malloc() failed */
#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */
#define SQLITE_FULL        13   /* Insertion failed because database is full */
#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
#define SQLITE_PROTOCOL    15   /* Database lock protocol error */
#define SQLITE_EMPTY       16   /* Database is empty */
#define SQLITE_SCHEMA      17   /* The database schema changed */
#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
#define SQLITE_MISMATCH    20   /* Data type mismatch */
#define SQLITE_MISUSE      21   /* Library used incorrectly */
#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
#define SQLITE_AUTH        23   /* Authorization denied */
#define SQLITE_FORMAT      24   /* Auxiliary database format error */
#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB      26   /* File opened that is not a database file */
#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
/* end-of-error-codes */

Some of these constants are returned only by a specific function, such as the SQLITE_RANGE, which is returned only by the SQlite3_bind_xxx function. Some constants, such as SQLITE_ERROR, only indicate that an error occurred during the execution of the function, but there is no way to know why the error occurred.
Sqlite_false stands for MISUSE of apis. For example, a bind function returns SQlite_ern when a statement is given another parameter after the sqlite3_step function has executed without being reset.
Extended Codes
Standard error codes provide less information about the cause of the error. So sometimes we use extended error codes. The extended error code is based on the standard error code, whose lower order byte is the original standard error code, and then attaches information to its higher order byte “or” to describe the details of the error.

int sqlite3_extended_result_codes(sqlite3*, int onoff);

The error codes for these extensions are not enabled by default due to compatibility issues with the client’s legacy programs. Programmers can enable or disable extended error codes by using the SQlite3_extended_result_CODES function.
Here are all the extended error codes (most of which describe SQLITE_IOERR) :

#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))
#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))
#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))
#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))
#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))
#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))
#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))
#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))
#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))
#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))
#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))
#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))
#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))
#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))
#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))
#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))
#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))
#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))
#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))
#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))
#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))
#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))

Error Functions

int sqlite3_extended_result_codes(sqlite3*, int onoff);

Enable or disable the use of extended error codes for a database connection. Enable extended error codes by passing a non-zero value to the second parameter of the SQlite3_extended_result_CODES function. This function always returns SQLITE_OK, and there is no way to get an extension error code that is currently enabled or off.

int sqlite3_errcode(sqlite3 *db);

If a database function operation does not return SQLITE_OK, you can then call the function to get the error code. By default it returns the standard error code, and it may also return an extended error code if the current database connection is enabled.

int sqlite3_extended_errcode(sqlite3 *db);

Similar to the SQlite3_errcode function, except that it only returns the extended error code.

const char *sqlite3_errmsg(sqlite3*);
const void *sqlite3_errmsg16(sqlite3*);

Returns an error code string, encoded in UTF-8 or UTF-16. Programmers should either call these functions, get the error code information, or make a copy. The next database operation may invalidate the returned string pointer.
SQlite error handling cannot handle multiple errors simultaneously. For example, if an API function call goes awrong and the programmer fails to check for that error, the next API function call may well return SQlite_ern, indicating that the program is trying to use an invalid data structure. So programmers should check and handle any errors that might occur after each API function call.
In addition, if multiple threads share the same database connection, it is best to encapsulate the core API calls and error-handling code in the Critical section. Programmers can use the SQlite3_db_mutex function to get the mutex pointer to the database connection (a pointer to the SQlite3_mutex object).
Prepare for V2 Version
The following table compares the prepare function of the original version with that of v2 version:

The V2 version of prepare is more concise for error handling and has the schema advantages listed in the table above, so it is recommended to use the V2 version of prepare.
Transactions and Errors
Typically, SQlite operations are in auto-commit mode. SQlite automatically encapsulates each SQL command into a transaction. Error recovery is easy if each statement is encapsulated in its own transaction. Any time SQLite finds itself in the wrong state, it simply rolls back the current transaction. This effectively cancels the current SQL command and returns the database to the state it was in before the error occurred.
However, once the BEGIN TRANSACTION command is executed, SQlite is no longer in autocommit mode. A TRANSACTION is opened and will remain open until either the END TRANSACTION or the COMMIT TRANSACTION command is executed. This allows multiple SQL commands to be encapsulated into a single transaction, allowing a discrete set of commands to execute either all or none (atomic operations), but it also limits SQLite’s error recovery.
When a displayed (explicit) transaction encounters an error during execution, SQLite attempts to cancel the statement just executed. Unfortunately, this is not always possible. If things go badly, SOMETIMES SQlite can just roll back the entire current transaction, with no other option.
The most likely errors to cause a rollback are SQLITE_FULL (database or disk space is full), SQLITE_IOERR (disk IO error or file is locked), SQLITE_BUSY (database lock), SQLITE_NOMEM (out of memory), SQLITE_INTERRUPT (interrupt). If the program is executing a display transaction and receives one of these errors, be prepared to handle the possibility of a transaction being rolled back.

int sqlite3_get_autocommit(sqlite3*);

With this function, you can get the current commit status. If a non-zero value is returned, the database is in auto-commit (atutoconmit) mode. If 0 is returned, the database is currently inside an explicit transaction.
If the SQlite database is forced to do a full transaction rollback, the database will once again go into transaction autocommit mode. If the database is not in auto-commit mode, it must be in a transaction, indicating that no rollback is required.

SQlite database C programming interface (VI) Result Codes and Error Codes by QQ: 253786989 2012-02-07

Txt import MySQL: error 1062 (23000): duplicate entry ‘0’ for key ‘primary’

Existing problems:
When importing TXT file into Mysql database, ERROR 1062(23000) always appears: Duplicate entry ‘0’ for key ‘PRIMARY’ ERROR, but TXT file does not have a data with ID (PRIMARY key) of 0.


Reason for error:
This is still not clear, because I have no record of ID=0, so I don’t know why the duplicate ID is 0. At first, I thought it was the data encoding that caused the data chaos, but later I found that even the same encoding could not solve the problem.

Solutions:
Setting the primary key (ID) to AI (Auto Incremental) is sufficient. Setup has been completed and import has been successful

Note:
I thought that if I set the primary key to AI, the primary key column would be 1, 2, 3… , because the primary key in TXT file is discontinuous, but I found that this understanding is wrong, after insertion, the primary key still maintains its discontinuity.

Version problem of SQL Server


Recently, SQL Server 2005 has been installed on the computer. It works normally on this computer. Everything is OK.

When connected to the server operation Database, however, you Unspecified error when creating the table:

The details of the error are as follows:

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


Unspecified error
 (MS Visual Database Tools)


------------------------------
Program Location:


   at Microsoft.VisualStudio.DataTools.Interop.IDTTableDesignerFactory.NewTable(Object dsRef, Object pServiceProvider)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.TableDesignerNode.CreateDesigner(IDTDocToolFactoryProvider factoryProvider, IVsDataConnection dataConnection)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDataDesignerNode.CreateDesigner()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDataDesignerNode.Open()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateDesigner(DocumentType editorType, DocumentOptions aeOptions, Urn parentUrn, IManagedConnection mc)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection mc, DocumentOptions options)

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

checked on the Internet, the original problem was between SQL Server versions: SQL Server 2005 Management Studio could not operate SQL Server 2008, so this error occurred.

The solution is to replace 2005 with 2008.

Solution of Oracle error 6550

When exporting data using the EXP command, the following appears:
EXP-00056: ORACLE error 6550 encountered
ORA-06550: line 1, column 41:
PLS-00302: component ‘SET_NO_OUTLINES’ must be declared
ORA-06550: line 1, column 15:
PL/SQL: Statement ignored
EXP-00000: Export terminated unsuccessfully
Cause
Use of Higher Version Export utility (10.2.0.1) on Lower Version database(9.2.0.6).
The main reason is that the server and client versions are not correct
You can modify oracle’s in the environment variable (Path)
D:/oracle/product/10.2.0/db_1/bin; D:/oracle/product/10.2.0/client_1/bin; The location of the
 

Configure: error: Cannot find libz error appears when brew installs php70

This article from the PHP ecshop secondary development blog, please be sure to keep this from http://phpecshop.blog.51cto.com/6296699/1883448

According to the tutorial “New Installation of Mac OS Sierra (10.12) and using HomeBrew to install ZSH + MNMP (Mac + Nginx + Mysql + Php) Development environment”, there was an error in using BREW to install PHP70 on the Mac.

brew install php70 --with-debug --with-gmp --with-homebrew-curl --with-homebrew-libressl --with-homebrew-libxml2 --with-homebrew-libxslt --with-imap --with-libmysql --with-mysql

Error message:

configure: error: Cannot find libz

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/josegonzalez/homebrew-php/issues

/usr/local/Homebrew/Library/Homebrew/utils/github.rb:226:in `raise_api_error': Validation Failed (GitHub::Error)
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:184:in `open'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:233:in `issues_matching'
    from /usr/local/Homebrew/Library/Homebrew/utils/github.rb:266:in `issues_for_formula'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:325:in `fetch_issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:321:in `issues'
    from /usr/local/Homebrew/Library/Homebrew/exceptions.rb:383:in `dump'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:133:in `rescue in <main>'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `<main>'

Solutions:


$ xcode-select --install


$ brew install php70 --with-debug --with-gmp --with-homebrew-curl --with-homebrew-libressl --with-homebrew-libxml2 --with-homebrew-libxslt --with-imap --with-libmysql --with-mysql

Fixed

Reference link:
http://stackoverflow.com/questions/39442552/5-boxen-errors-when-running-boxen-our-boxen

MYSQL ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails

This may be because MySQL has set foreign Key association in InnoDB, which makes it impossible to update or delete data. You can avoid this situation by setting the FOREIGN_KEY_CHECKS variable.
SET FOREIGN_KEY_CHECKS = 0;
SET
SET FOREIGN_KEY_CHECKS = 1;

SET FOREIGN_KEY_CHECKS = 0;
SET
SET FOREIGN_KEY_CHECKS = 1;
ERROR 1452 (23000): Cannot add or update a Child row: a foreign key constraint fails…… (foreign key restrictions cannot be inserted)
can also use (SET FOREIGN_KEY_CHECKS = 0; ) insert

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

MySQL Workbench performs complex operations on large tables as follows: Error Code: 2013. Lost connection to MySQL server during query
Solutions:
Edit-> Preference-> SQL Editor
Appropriately increase the FOLLOWING DBMS Connection Read Time out(in seconds) :

Resources:
http://bbs.csdn.net/topics/391881939?page=1
https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html

Error: cannot fetch last explain plan from plan_table

OS: Solaris 10
DB: 10.2.0.3
today encountered such a strange thing, using dbms_xplan.display a SQL execution plan, “Error: cannot fetch last explain plan from plan_table”. At the beginning think Plan_table version is out of date, also did not look carefully, then regenerate Plan_table, just run SQL, or report the same error, so it is not Plan_table version of the problem, will it be the SQL itself?Change SQL: select sysdate from Dual, dbMS_xplan.display to display the correct result, run the SQL in question again, the error still remains. Judging from the above phenomenon, that should be the problem with SQL itself.
analyze the SQL in question, mainly several views, these views are based on db link, db link side of the data version is 9.2.0.8, could this be caused by this reason?Delete the 10G plan_table, run the 9i UTlxplan.sql, and run the statement with the problem just now, dbMS_xplan.display displays the result normally.
there is another method, manually update the plan_id field in the 10G plan_table, set the plan_id in the record to a value, dbms_xplan.display can display the result normally.

From “ITPUB blog” link: http://blog.itpub.net/45188/viewspace-1022784/, if you want to reprint, please indicate the source, otherwise will be investigated for legal responsibility.

Reproduced in: http://blog.itpub.net/45188/viewspace-1022784/

error C2471: cannot update program database vc90.pdb

Why is it that after I convert a VC6 project to a VS2008 project, the compilation always fails to find and cannot upgrade the VC90.pDB file?Recompiling doesn’t work either.
jump directly from VC6 to VS2008
This VS2008 is a well-known bug. See https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?for details FeedbackID=309462
The official current solution is as follows:
I have found an alternate way for the time beging to avoid C2471 error but it works only in the case of successful release build.
for this click build menu than Configuration manager than create a new setting from release settings. Change following things in your project settings as :

C\C++ | General | Debug Information format | C7 Compatible (/Z7)
C\C++ | Code Generation | Enable String Pooling | Yes (/GF)
Linker |Debuging |General Debug Info | Yes (/DEBUG)

Reproduced in: https://www.cnblogs.com/kex1n/archive/2012/01/14/2322164.html

Error while trying to retrieve text for error ORA-01019 solution

For a long time, this article helped me, thank you!
The original address: https://www.cnblogs.com/zhenfei/p/4425874.html

This issue involves 64-bit Oracle services and 32-bit clients causing problems.
The environment is as follows: Win8.1 + 64-bit Oracle 11.1 server, client because of the use of 32-bit program, do not support 64-bit Oracle client, so use 32-bit 10.2 InstantClient package.
Problem: Unable to connect oracle server, PLSQL and SQLPLUS all connect normally, Error Error while trying to retrieve Text for Error orA-01019.
The Oracle documentation describes this error as:
Ora-01019: incapable to allocate memory in the user
Cause: the user side memory allocator returns error.
Action: Increase the processes heap size or switch to the old set of calls.
 
Solution:
The reason for this seems to be that ODBC USES drivers provided by systems other than ORACLE_HOME instead of using drivers provided by Oracle. It’s obviously not a memory problem. So the first step is:
1. Add ORACLE_HOME to the environment variable to point to the 64-bit installation directory instead of instantClient. I think this step would allow Windows to use a matching file to drive
After you do the first step, and then connect, the error message becomes an error that you cannot allocate memory. And then the second step
2. Replace 10.2 Instantclinet package with 11.1 matching 32-bit InstantClient package
After changing, the connection is normal.
 
The tns_admin and PATH variables in the environment can both point to the 32-bit instantClient package location path.