PDO_firebird can't execute prepare statement with integer parameters - pdo

I've got problem with some query execution with PDO_firebird on PHP server.
On 2 of my server, when I execute the code below, I get an error.
$sth=$dbh->prepare('SELECT * FROM myTable WHERE myField= ?');
$sth->execute(array(10));
The error:
Dynamic SQL Error SQL error code = -303 arithmetic exception, numeric
overflow, or string truncation.
This error is present only from one PHP server, the other server PHP that connect to the same Firebird 2.5 server doesn't have this problem.
The problem appears only when I try to filter on integer field.
Any idea?

Related

Error handling in SQL and bypassing errors

I'm querying from a linked server that is returning the following error message. The query results look fine but I'm unable to run an INSERT statement using the code because of this. Is there a way to bypass the error and execute the stored procedure anyway. Changing the table design in the data source is not an option.
OLE DB provider 'MSDASQL' for linked server 'ServerName' returned data
that does not match expected data length for column
'[ServerName]..[SQLUser].[STUSER].USERID'. The (maximum) expected data
length is 4, while the returned data length is 5.

Jmeter java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended

I am trying to delete a record from my database using Jmeter and I am having some difficulties. I can query just fine, but when it comes to DELETE, I am getting an error. I enter the following code in my Jmeter:
delete from DATA_RECORDS where DATA_RECORDS_ID = (select id from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue');
delete from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue';
After running the test in Jmeter I get the following error:
java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
However when I enter that same code in my SQLDeveloper, SQL actually runs the script and it deletes the appropriate data.
The Query Type is set to: Update Statement and I have nothing in the remaining fields: Parameter values, Parameter types, Variable names, etc. I would also like to mention that I am running Jmeter 3.2 GUI mode. If you could help me out that would greatly be appreciated. Thanks!
Separate to 2 jdbc requests:
delete from DATA_RECORDS where DATA_RECORDS_ID = (select id from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue')
delete from DATA_RECORDS_STORE where RESOURCE_IDENTIFIER='somevalue'

DB2 SQL Error: SQLCODE=-901, SQLSTATE=58004, SQLERRMC=Invalid collation ID, DRIVER=4.21.29

Trying to execute the statement
select *
from RU_VARIANCE_HISTORY
but I'm getting the error
DB2 SQL Error: SQLCODE=-901, SQLSTATE=58004,
SQLERRMC=Invalid collation ID, DRIVER=4.21.29
Tried searching but unable to find the solution.
This can happen if DB2 thinks the statement is really too long or too short. Try adding a semicolon to the end of your statement - this worked for me with the same error.

Firebird select statement gives SQLSTATE = 42S02

I've made a very simple database and am trying
select * from klant;
I've verified the table exists, and last week was able to see data in it. Today however I keep getting
Statement failed, SQLSTATE = 42S02
Dynamic SQL Error
-SQL error code = -204
-Table unknown
-KLANT
-At line 1, column 15
The same select query in flameRobin gives the following error:
Error: *** IBPP::SQLException ***
Context: Database::Statistics
Message: isc_database_info failed
SQL Message : -902
can't format message 13:98 -- message file C:\WINDOWS\SYSTEM32\firebird.msg not found
Engine Code : 335544727
Engine Message :
Error writing data to the connection.
I have copied the firebird.msg to the system32 folder so it should be able to find it there.
Any pointers toward the solution would be greatly appreciated. Similar question all seem to point toward issues with transactions, I can't see that being the problem here.
Edit:
I'm using the included ISQL tool from firebird and start the session by connecting to the database that includes my table. Same for flamerobin, first connect to database, I can see the table that i want to select from but it gives this error.
Edit2:
Finally reinstalled Firebird making sure I gave it admin right, which I think it had before, but wasn't sure about. This seems to have fixed it.

SQL Permission Problem

I have having an issue with a SQL execution where I am getting an error message
-2147217843 Login Failed for user.
I am able to successfully open the connection to the database and execute select count(*) queries.
I am getting this error when I include fields.
In a separate application that uses the same fields I am able to retrieve the same data so seems to rule out column permissions.
The query coming back with no error is:-
SELECT tbl_PersonalDetails.SystemID
FROM tbl_PersonalDetails
WHERE tbl_PersonalDetails.Title IS NOT NULL
And tbl_PersonalDetails.HospitalNumber IS NOT NULL
AND tbl_PersonalDetails.SiteID = 1
The query coming back with the error is:-
SELECT DISTINCT tbl_PersonalDetails.Title,tbl_PersonalDetails.HospitalNumber
FROM tbl_PersonalDetails
WHERE tbl_PersonalDetails.SiteID = 1
ORDER BY tbl_PersonalDetails.Title,tbl_PersonalDetails.HospitalNumber ASC
This is not specific to these particular queries, in the first query where we are just doing a count I always get a count back with no issue, when I try to request fields such as in the second I always get the Login Error.
Your problem isn't in the SQL queries you've posted. They would either all fail or all succeed based on the information given.
Your problem is your calling/client code. Sounds like you're using Classic ASP ("recordset....adodb connection").
Double check that your ASP code is using the proper connection strings.
To prove this, run any of these queries in SQL Server Management Studio. Connect using the credentials that your connection string contains.