[Oracle][ODBC SQL Server Driver]String data, right truncation {01004}
While importing data from SQL Server 2005 to Oracle gateway 11g Release2, i am getting following error:
insert into CSDescr select * from CSDescr@sqlserver
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
+[Oracle][ODBC SQL Server Driver]String data, right truncation {01004}+
ORA-02063: preceding 2 lines from SQLSERVER
Oracle database characterset is AL32UTF8
SQLServer database characterset is SQL_Latin1_General_CP1_CI_AS
Following is the configuration in the parameter file for gateway:
HS_KEEP_REMOTE_COLUMN_SIZE=LOCAL
HS_NLS_LENGTH_SEMANTICS=CHAR
I think setting the HS_LANGUAGE parameter shall fix the error but I want to know what should be the value of this parameter?
HS_LANGUAGE needs to be set to a character set that is used by the foreign database
So try: HS_LANGUAGE=american_america.WE8MSWIN1252
Also specify HS_NLS_NCHAR=UCS2 as the nvarchars of a SQl Server are stored in UCS2 character set
Similar Messages
-
When I migrate CLOB datas from Oracle 10g to PostgreSQL 9.0,and the target data type is text,the replicat process abend,and it reports as following:
WARNING OGG-03056 Oracle GoldenGate Delivery, repdb2.prm: Source table SDCMNET.T_INFO_SUPERIOR_PROGRAM column PRO_CONTENT_CLOB data size exceeds the maximum target table sdcmnet.t_info_superior_program column pro_content_clob size. Automatic truncation is enabled for all tables/columns without further warnings.
WARNING OGG-00869 Oracle GoldenGate Delivery, repdb2.prm: [SQL error 0 (0x0)][Oracle][ODBC PostgreSQL Wire Protocol driver]String data, right truncated.
WARNING OGG-01004 Oracle GoldenGate Delivery, repdb2.prm: Aborted grouped transaction on 'sdcmnet.t_info_superior_program', Database error 0 ([SQL error 0 (0x0)][Oracle][ODBC PostgreSQL Wire Protocol driver]String data, right truncated.
But,according to the SEQNO and RBA,I find the records have been migrated,and the length of records is equal to what is in oracle.Then I try to use the odbc driver of postgresql 9.3 to replace,although I can login the database ,but it warns again.
Can anyone help me?This forum is for Oracle Maven Repository. You might have more luck posting your question in an forum for GoldenGate - you are more likely to find someone who knows about that product in its own forums.
-
I am using oracle gateway (11.1) for sqlserver on Linux platform with Oracle Server 10g.
I am getting following error when i run any select query:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Oracle][ODBC SQL Server Driver][libssclient22]General network error. Check your network documentation.[Oracle][ODBC SQL Server Driver][libssclient22]ConnectionOpen (connect()).[Oracle][ODBC SQL Server Driver]Invalid connection string attribute
ORA-02063: preceding 2 lines from SQLSERVER
Another thing is, i have created a ODBC DSN named as "sqlserver" as well. This configuration works fine when "program" parameter is set to dg4odbc in Listener.ora. But with dg4msql, it gives error.
Followings are the configuration files:
initsqlserver.ora
# HS init parameters
HS_FDS_CONNECT_INFO=database_machine:1433//test_master
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
listener.ora
SID_LIST_sqlserver =
(SID_LIST =
(SID_DESC =
(SID_NAME = sqlserver)
(ORACLE_HOME = /u01/app/oracle/product/11.1.0.6.0/gateway)
(PROGRAM = dg4msql)
sqlserver =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Server_Machine )(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))
tnsnames.ora
SQLSERVER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Server_Machine)(PORT = 1522))
(CONNECT_DATA =
(SID = sqlserver)
(HS = OK)
)Hi,
The error you get is because your HS_FDS_CONNECT_STRING is not correct:
Be sure you can ping the SQL SERVER name from the Oracle Server,or use TCP/IP address
Check the port, it is not necessary 1433.
You can use the instance name insted of port:
HS_FDS_CONNECT_STRING=server_ip_address/instance_name/database_name
Be careful, in the LISTENER.ORA, you must specify the Gateway machine and not the SQL SERVER machine:
sqlserver =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Gateway_Machine )(PORT = 1522)) <====you must specify Oracle Gateway machine
(ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))
Idem for TNSNAMES.ORA:
SQLSERVER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Gateway_Machine)(PORT = 1522))
(CONNECT_DATA =
(SID = sqlserver)
(HS = OK)
Regards
Mireille -
[JDBC Progress Driver]:String data, right truncated.
Hi everybody,
I have a strange error that i just cannot figure out.
I have a entitybean with an EJBStore method. In that method I create a PreparedStatement like this
String update = "update myTable set commentField = ? where objectnumber = ?";
PreparedStatement pstmt = con.prepareStatement(update);
pstmt.setString(1, commentString);
pstmt.setString(2, objectnumber); The database field "commentField" has a max of 250 characters as defined in the database. The string "commentString" is a normal string.
The problem is, if any character higher than ALT-127 is stored, it seems that 2 bytes are used when validating field length. This means that I can store 250 of "A"'s (ALT-065) but just 125 "�"'s (ALT-128).
When I try to update the field with 126+ "�"'s i get the folowing message:
javax.ejb.EJBException: [JDBC Progress Driver]:String data, right truncated. Error in parameter 1.This errormessage is exactly the same when I try to update the same field with 251+ "A"'s
The strangest is: manually, with a SQL-tool provided by Progress I can easily add 250 "�"'s in the database. So I think it might be the JDBC driver.
This maybe has something to do with encodings, but when I use "String.getbytes()" with different encodings en count the number of bytes, these are always correct (byte[].length <= 250) and the same errormessage appears.
Could someone shed some ligth on my problem? I'm completely lost.
Thank you for your time and attention,
Leon Noordermeer
[email protected]
Some extra info:
JDK1.2.1
Progress 91A
JDBC driver suplied with Progress 91A
Apptivity 3.2Hello!
Did anyone get jdbc connection with Progress dabase successfully?
Did any one know this error message when I connect from client to server?
java.sql.SQLException: [JDBC Progress Driver]:Exceeding permissible number of connections.
I would greatly appreciate if anyone can let me know. -
Problem Description:
ODBC functions SQLExecDirectW and SQLExecute functions return error:”DIAG [22001] [Microsoft][SQL Server Native Client 10.0]String data, right
truncation (0) “. When we enable tracing in the ODBC administrator, in the SQL.log we see that values for the arguments: ColumnSize, BufferLength, and StrLen_or_IndPtr of ODBC function SQLBindParameter are not being displayed.
Environment Used:
OS: Microsoft Windows Server 2003 R2 Standard x64 Edition.
Complier: Microsoft Visual Studio 2008 SP1 for x64.
Database: Microsoft SQL Server 2008
MDAC: Microsoft Data Access Components SDK 2.8
Note: This problem is seen only in our 64bit application. However, in 32bit
SQLExecDirectW and SQLExecute functions return successfully.
As we could not find the values of 6<sup>th</sup>, 9<sup>th</sup> and 10<sup>th</sup> arguments(ColumnSize,
BufferLength, and StrLen_or_IndPtr) passed to
SQLBindParameter in the ODBC traces for 64bit, we are not sure whether the values for the above mentioned arguments are received correctly by SQLBindParameter or not. This information would help us to debug further. So, could you please let us know why
these values are not displayed.
1)Here is the extract of the SQL.log file for 32bit where the values for SQLULEN , SQLLEN and SQLLEN* are displayed properly:
PR0CNFG 1028-15f0 ENTER SQLBindParameter
HSTMT 0x006FBDD8
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD -8 <SQL_C_WCHAR>
SWORD -9 <SQL_WVARCHAR>
SQLULEN 23
SWORD 0
PTR 0x0595EBBA
SQLLEN 46
SQLLEN * 0x05A5FB00
2)Here is the extract of the SQL.log file for 64bit where the values for SQLULEN , SQLLEN are not displayed properly and
SQLExecDirectW function return error:”DIAG
[22001] [Microsoft][SQL Server Native Client 10.0]String data, right truncation (0) “. :
PR0CNFG a78-fe4 ENTER SQLBindParameter
HSTMT 000000000431D2F0
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD -8 <SQL_C_WCHAR>
SWORD -9 <SQL_WVARCHAR>
SQLULEN SQLULEN SWORD 0
PTR 0x0000000005364EFA
SQLLEN SQLLEN
SQLLEN * SQLLEN *
PR0CNFG a78-fe4 EXIT SQLBindParameter with return code 0 (SQL_SUCCESS)
HSTMT 000000000431D2F0
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD -8 <SQL_C_WCHAR>
SWORD -9 <SQL_WVARCHAR>
SQLULEN SQLULEN SWORD 0
PTR 0x0000000005364EFA
SQLLEN SQLLEN SQLLEN *Hi Nalsr,
From my research, I found:
"[Microsoft][ODBC SQL Server Driver]String
data right truncation" error may be returned from a call to
SQLBindParameter if the size of the string parameter being used is greater than the size of the column being compared to. In other words if the
string size of the <expression> to the left of the <comparison_operator> is less than the
string size of the <expression> to the
right, ODBC may return this error.
The resolution is to make the string size of the <expression> to the
right of the <comparison_operator> less than or equal to the
string size of the <expression> on the left.
It is difficult to track down this type of problem when third party development applications are being used. ODBC Trace can be used to help determine if this problem is occuring.
Here is an example where the customer has submitted a query "select count(*) from type1 where type1 = ?", type1 is varchar(5) and the
data type being passed by the application is char[9].
Here is the relevant portion of the trace. The following information from the "exit" of SQLDescribeParam
SWORD * 0x0095e898 (12)
UDWORD * 0x0095e880 (5)
Maps to the following with the actual value in parenthesis - SQL_VARCHAR Size 5:
SQLSMALLINT *DataTypePtr
SQLUINTEGER *ParameterSizePtr
The "exit" value from SQLBindParameter provides the following
information:
SWORD 1 <SQL_PARAM_INPUT>
SWORD 1 <SQL_C_CHAR>
SQL Data Type SWORD 12 <SQL_VARCHAR>
Parameter Size UDWORD 5
SWORD 0
Value PTR 0x0181c188
Value Buffer Size SDWORD 5
String Length SDWORD * 0x0181c103 (9)
The string length parameter is the length of the
string being bound to the parameter, in this instance there is a size mismatch which results in the SQLError and the SQLErrorW with the message "[Microsoft][ODBC SQL Server
Driver]String data
right truncation" .
Hope this could be helpful.
Best regards,
Halin Huang -
I have an application which connects to SQL through ODBC 11.
ODBC statement is :
SELECT PID
FROM PENTITY PENTITY01 WHERE ((NUM1 NOT BETWEEN ? + 10.7895 AND ? + 200.6734 AND NUM2 NOT IN (5996/ 8, ? - 89.3892, ? + 80.7543))
and the SQLBindparameter statement is :
static UCHAR num1[12]=12.589
rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, sqlType, precision, scale,
&num1, sizeof(num1), NULL);
With this SQLBindparameter statement I am getting error, It is working without any error if I change the value to 12.
The same code is working when connecting to SQL server 2008.
Thanks in advance.Hi Nalsr,
From my research, I found:
"[Microsoft][ODBC SQL Server Driver]String
data right truncation" error may be returned from a call to
SQLBindParameter if the size of the string parameter being used is greater than the size of the column being compared to. In other words if the
string size of the <expression> to the left of the <comparison_operator> is less than the
string size of the <expression> to the
right, ODBC may return this error.
The resolution is to make the string size of the <expression> to the
right of the <comparison_operator> less than or equal to the
string size of the <expression> on the left.
It is difficult to track down this type of problem when third party development applications are being used. ODBC Trace can be used to help determine if this problem is occuring.
Here is an example where the customer has submitted a query "select count(*) from type1 where type1 = ?", type1 is varchar(5) and the
data type being passed by the application is char[9].
Here is the relevant portion of the trace. The following information from the "exit" of SQLDescribeParam
SWORD * 0x0095e898 (12)
UDWORD * 0x0095e880 (5)
Maps to the following with the actual value in parenthesis - SQL_VARCHAR Size 5:
SQLSMALLINT *DataTypePtr
SQLUINTEGER *ParameterSizePtr
The "exit" value from SQLBindParameter provides the following
information:
SWORD 1 <SQL_PARAM_INPUT>
SWORD 1 <SQL_C_CHAR>
SQL Data Type SWORD 12 <SQL_VARCHAR>
Parameter Size UDWORD 5
SWORD 0
Value PTR 0x0181c188
Value Buffer Size SDWORD 5
String Length SDWORD * 0x0181c103 (9)
The string length parameter is the length of the
string being bound to the parameter, in this instance there is a size mismatch which results in the SQLError and the SQLErrorW with the message "[Microsoft][ODBC SQL Server
Driver]String data
right truncation" .
Hope this could be helpful.
Best regards,
Halin Huang -
ORA-28500 + "String data, right truncation" when selecting nvarchar(max)
Hi,
I was able to set up a db link from Oracle 11.2.0.1 to SQL Server 2005 using DG4ODBC.
When trying to select a column with nvarchar(max) datatype from the db link I get the following error:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}
ORA-02063: preceding 2 lines from SQLSERVER_DBLINKThe actual data in the column doesn't exceed 31 chars but the query still fails.
Any suggestions?
Thanks.The character set is AL32UTF8
Here is the relevant data from the trace file:
Entered hgopars, cursor id 1 at 2010/12/23-12:08:59
type:0
SQL text from hgopars, id=1, len=47 ...
00: 53454C45 43542041 312E2243 6F6D6D65 [SELECT A1."Comme]
10: 6E742220 46524F4D 20224442 4F222E22 [nt" FROM "DBO"."]
20: 565F4442 56455253 494F4E22 204131 [V_DBVERSION" A1]
Exiting hgopars, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxpars
hostmstr: 2011148288: HOA Before hoxopen
Entered hgoopen, cursor id 1 at 2010/12/23-12:08:59
hgoopen, line 87: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxopen
hostmstr: 2011148288: HOA Before hoxdscr
Entered hgodscr, cursor id 1 at 2010/12/23-12:08:59
Allocate hoada @ 038B493C
Entered hgopcda at 2010/12/23-12:08:59
Column:1(Comment): dtype:-9 (WVARCHAR), prc/scl:0/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/12/23-12:08:59
hgodscr, line 910: Printing hoada @ 038B493C
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x40:TREAT_AS_NCHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
12 VARCHAR Y 0 0 128/ 0 1000 0 40 Comment
Exiting hgodscr, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxdscr
hostmstr: 2011148288: RPC After SQL Bundling
hostmstr: 2011148288: RPC Before SQL Bundling
hostmstr: 2011148288: HOA Before hoxclse
Entered hgoclse, cursor id 1 at 2010/12/23-12:08:59
Exiting hgoclse, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxclse
hostmstr: 2011148288: HOA Before hoadafr
Entered hgodafr, cursor id 1 at 2010/12/23-12:08:59
Free hoada @ 038B493C
Exiting hgodafr, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoadafr
hostmstr: 2011148288: HOA Before hoxpars
Entered hgopars, cursor id 1 at 2010/12/23-12:08:59
type:0
SQL text from hgopars, id=1, len=47 ...
00: 53454C45 43542041 312E2243 6F6D6D65 [SELECT A1."Comme]
10: 6E742220 46524F4D 20224442 4F222E22 [nt" FROM "DBO"."]
20: 565F4442 56455253 494F4E22 204131 [V_DBVERSION" A1]
Exiting hgopars, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxpars
hostmstr: 2011148288: HOA Before hoxopen
Entered hgoopen, cursor id 1 at 2010/12/23-12:08:59
hgoopen, line 87: NO hoada to print
Deferred open until first fetch.
Exiting hgoopen, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxopen
hostmstr: 2011148288: HOA Before hoxdscr
Entered hgodscr, cursor id 1 at 2010/12/23-12:08:59
Allocate hoada @ 038B6C98
Entered hgopcda at 2010/12/23-12:08:59
Column:1(Comment): dtype:-9 (WVARCHAR), prc/scl:0/0, nullbl:1, octet:0, sign:1, radix:0
Exiting hgopcda, rc=0 at 2010/12/23-12:08:59
hgodscr, line 910: Printing hoada @ 038B6C98
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x40:TREAT_AS_NCHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
12 VARCHAR Y 0 0 128/ 0 1000 0 40 Comment
Exiting hgodscr, rc=0 at 2010/12/23-12:08:59
hostmstr: 2011148288: HOA After hoxdscr
hostmstr: 2011148288: RPC After SQL Bundling
hostmstr: 2011148288: RPC Before Fetch Row
hostmstr: 2011148288: HOA Before hoaftch
Entered hgoftch, cursor id 1 at 2010/12/23-12:08:59
hgoftch, line 130: Printing hoada @ 038B6C98
MAX:1, ACTUAL:1, BRC:100, WHT=5 (SELECT_LIST)
hoadaMOD bit-values found (0x40:TREAT_AS_NCHAR)
DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
12 VARCHAR Y 0 0 128/ 0 1000 0 40 Comment
Performing delayed open.
SQLBindCol: column 1, cdatatype: -8, bflsz: 2
Entered hgopoer at 2010/12/23-12:08:59
hgopoer, line 233: got native error 0 and sqlstate 01004; message follows...
[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}
Exiting hgopoer, rc=0 at 2010/12/23-12:08:59
hgoftch, line 740: calling SQLFetch got sqlstate 01004
Entered hgopoer at 2010/12/23-12:08:59
hgopoer, line 233: got native error 0 and sqlstate 01004; message follows...
[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}[Microsoft][SQL Native Client]String data, right truncation {01004}
Exiting hgopoer, rc=0 at 2010/12/23-12:08:59
hgoftch, line 971: calling SQLGetData got sqlstate 01004
100 rows fetched
Exiting hgoftch, rc=28500 at 2010/12/23-12:08:59 with error ptr FILE:hgoftch.c LINE:971 ID:Row error while doing array fetch
hostmstr: 2011148288: HOA After hoaftch
hostmstr: 2011148288: RPC After Fetch RowThanks -
Problem Summary
DG4ODBC: STRING DATA, RIGHT TRUNCATION ERROR WHILE ACCESSING VARCHAR(MAX) COLUMN
Driver
Microsoft® ODBC Driver 11 for SQL Server® - RedHat Linux
Problem Description
When selecting a MS SQL VARCHAR (max) column over a ODBC Gateway database connection I am getting this error from Oracle:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
[Microsoft][ODBC Driver 11 for SQL Server]String data, right truncation {01004}
ORA-02063: preceding 2 lines from <LINK_NAME>
The ODBC driver should map the varchar(max) column to SQL_LONGVARCHAR which would be appropriate for Oracle but the column is getting truncated
Issue
By default the SQL Server ODBC driver exposes the varchar(max) data type as a SQL_VARCHAR. When reporting the maximum size of a varchar(max) column, the driver returns 0, which is the Microsoft convention for "unlimited".
[ODBC][25518][1399527750.588980][SQLDescribeCol.c][497]
Exit:[SQL_SUCCESS]
Column Name = [raw_response]
Data Type = 0x7fffe3cbe1a4 -> 12
Column Size = 0x7fffe3cbe158 -> 0
Decimal Digits = 0x7fffe3cbe1ac -> 0
Nullable = 0x7fffe3cbe1b0 -> 1
DG4ODBC is unable to interpret a zero length as an "unlimited" size and returns an error when retrieving varchar(max) data.
FreeTDS and DataDirect ODBC drivers return SQL_LONGVARCHAR instead of SQL_VARCHAR with 0 precision. So there is no problem reported for these drivers.
Is there a fix for this or is the Microsoft ODBC driver team working on a fix for the driver regarding varchar(max)?
Regards,
JamesHi James,
Thank you for your question. I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
If you have any feedback on our support, please click
here.
Regards,
Elvis Long
TechNet Community Support -
String data right truncation error
Hi, what does this message mean?
Thread id: 14 : Fail to load bulk into DB ERROR in TTCommand.cpp, line 329: Error in TTCmd::Execute() while executing statement
[TimesTen][TimesTen 7.0.5.6.0 ODBC Driver]String data right truncation
*** ODBC Error/Warning = 22001, TimesTen Error/Warning = 0
*** Command execution of statement <insert into TA.TEST values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)> failed.*** Error in TTCmd::ExecuteBatch() : batch of <105> operations failed; only <1> operations succeeded
Thanks in advance,
AndreyIt means what it says. You are trying to insert a string into a CHAR/VARCHAR/NVARCHAR/BINARY/VARBINARY field and the length of the data you are trying to insert is longer than the defined maximum length of a column.
For example, given a table such as:
CREATE TABLE T1
COL1 VARCHAR2(4)
and the prepared statement
INSERT INTO T1 VALUES ( ? );
If I pass 'ABCD' for the parameter then all works fine but if I pass 'ABCDE' for the parameter I get
22001: String data right truncation
You need to ensure that no data you pass in exceeds the expected column width.
Chris -
Hi,
We have exadata x3-2. I am seeing this error in alert log file frequently.
The db version: 11.2.0.3 On RAC on Linux 5.8 x86-64Bit
Errors in file /d01/oracle/TEST/11.2.0/admin/TEST1_dbtest/diag/rdbms/prod/TEST1/trace/TEST1_reco_11909.trc:
ORA-01017: invalid username/password; logon denied
[Oracle][ODBC SQL Server Wire Protocol driver][SQL Server]Login failed for user 'RECOVER'. {28000,NativeErr = 18456}
ORA-02063: preceding 2 lines from HIS_CUST
The file /d01/oracle/TEST/11.2.0/admin/TEST1_dbtest/diag/rdbms/prod/TEST1/trace/TEST1_reco_11909.trc
Contains many repeated lines like below
*** 2015-01-21 06:34:40.209
ERROR, tran=21.24.51311, session#=1, ose=0:
ORA-01017: invalid username/password; logon denied
[Oracle][ODBC SQL Server Wire Protocol driver][SQL Server]Login failed for user 'RECOVER'. {28000,NativeErr = 18456}
ORA-02063: preceding 2 lines from HIS_CUST
Could any please help why is this happening.
ThanksHi,
You have customers who are running distributed transactions using a gateway which need to be rolled back. However, the gateway has not been correctly configured for distributed transactions. To roll back a transaction on the SQL*Server database a connection is made as the user defined in the parameter HS_FDS_RECOVERY_ACCOUNT in the gateway init<sid>.ora file but this user has not been created in the SQL*Server database with the password defined in HS_FDS_RECOVERY_PWD. This user also needs to own the transaction log table.
I assume you are using the Database Gateway for SQL*Server (DG4MSQL) as the Database Gateway for ODBC (DG4ODBC) doesn't support distributed transaction.
If you have access to My Oracle Support have a look at this note -
How to Setup DG4MSQL to Use Distributed Transactions (Doc ID 227011.1)
Otherwise, check the Gateway documentation.
Regards,
Mike -
I'm looking for some general guidance on this complete error:
Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
String data, right truncation [SQLSTATE 01004]
Msg 16389, Sev 16, State 1: The connection is no longer usable because the server response for a previously executed statement was incorrectly formatted. [SQLSTATE 08S01]
This error is caused by a SQL Agent Job, but it does not always occur. I understand this could be an issue with SQL dropping the connection, but what is the best way to troubleshoot this?
Thanks,
PhilHi philliptackett77,
It would be more helpful for troubleshooting the issue if you post the SQL Server error log and SQL Server version. Additionally, please state what purpose of using the agent job.
Based on my research, [SQLSTATE 08S01] error means communication link failure. If the executed statement returns invalid value in the job, the connection between server and client will fail. This error could be caused by the error of [SQLSTATE HY000] and
[SQLSTATE 01004]. I’d like to share my knowledge about these errors as below.
Quote: String data, right truncation [SQLSTATE 01004]
This error could occur when passing data whose length is larger than the received object,and the passed value is truncated, and returns invalid value. So please check if the data type of the objects are identical and the length of passed value is not larger
than the received object.
Quote: Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
The error could occur in the two cases below.
1. If you use SQL Server version 6.50, and execute the cursor in the job step, set the statement options to use a server-side cursor and prepare a select statement on a SQL Server system table. The first execution of the select creates the cursor successfully.
After you close this cursor, if you execute the prepared statement again, the error could occur.
I recommend you to apply the latest service pack firstly. If the error still occurs, you could change your code by using a forward-only cursor instead of a static, keyset, or dynamic cursor on the system tables. If a forward-only cursor is unacceptable,
prepare the select statement again on the system table and execute it to create a server-side cursor. For more information about the process, please refer to the article:
http://support.microsoft.com/kb/151693/en-us
2. The TDS stream from the server is invalid when transfer data between a database server and a client. This error is typically caused by a problem on the server. For more information about errors above, please refer to the article:
http://technet.microsoft.com/en-us/library/aa937531(v=sql.80).aspx
Regards,
Michelle Li -
Getting [Microsoft][ODBC SQL Server Driver] Optional feature not implemented
I am using below mentioned code to insert values in MSAccess 2000 which having table structure as mentioned below:-
Field Name Data Type
TodaysDate Date/Time
Cart ID Number
Client Name Text
Campaign Text
Team & Segment Text
Duration Number
Tape ID Text
Start Date Date/Time
End Date Date/Time
Station Text
Code:-
private boolean enterDataIntoMSAccessDatabaseusingPreparedStatement()
try {
ps = connection.prepareStatement("INSERT INTO Cart ID Details VALUES (?,?,?,?,?,?,?,?,?)");
System.out.println("After Query");
catch (SQLException se) {
generateErrorMessage("Error in Prepared Statement \n " + se.getMessage() );
return false;
catch (Exception e)
generateErrorMessage("Unexpected Error Occured \n " + e.getMessage());
String todaysDate = cartIDApplicationAddCartIDDatejTextField.getText().trim();
String cartID = cartIDApplicationAddCartIDCartIDjTextField.getText().trim();
String clientName = cartIDApplicationAddCartIDClientNamejTextField.getText().trim();
String campaign = cartIDApplicationAddCartIDCampaignjTextField.getText().trim();
String teamSegment = cartIDApplicationAddCartIDTeamAndSegmentjTextField.getText().trim();
String duration = cartIDApplicationAddCartIDDurationjTextField.getText().trim();
String tapeID = cartIDApplicationAddCartIDTapeIDjTextField.getText().trim();
String startDate = cartIDApplicationAddCartIDStartDatejTextField.getText().trim();
String endDate = cartIDApplicationAddCartIDEndDatejTextField.getText().trim();
String station = cartIDApplicationAddCartIDDELjCheckBox.getText().substring(0, 3);
System.out.println(station);
try {
System.out.println("Before ps.setString()");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-mm-dd", Locale.ENGLISH);
System.out.println("Simple Date Format");
/*ps.setString(1, todaysDate);
ps.setString(2, cartID );
ps.setString(3, clientName);
ps.setString(4, teamSegment);
ps.setString(5, duration);
ps.setString(6, tapeID);
ps.setString(7, startDate);
ps.setString(8, endDate);*/
System.out.println("1");
ps.setDate(1, new java.sql.Date(simpleDateFormat.parse(todaysDate).getTime()));
ps.setString(2, cartID);
ps.setString(3, clientName);
ps.setString(4, campaign);
ps.setString(5, teamSegment);
ps.setString(6, duration);
ps.setString(7, tapeID);
ps.setDate(8, new java.sql.Date(simpleDateFormat.parse(startDate).getTime()));
ps.setDate(9, new java.sql.Date(simpleDateFormat.parse(endDate).getTime()));
ps.setString(10, station);
System.out.println("After ps.setString()");
ps.executeUpdate();
catch (SQLException se) {
generateErrorMessage("Error while inserting data in database \n " + se.getMessage());
return false;
catch (Exception e)
generateErrorMessage("Unexpected Error Occured \n" + e.getMessage() );
return true;
I got below error after implementing the above code:-
[Microsoft][ODBC SQL Server Driver]Optional feature not implemented.
Kindly help me for the same.>> [Microsoft][ODBC SQL Server Driver]
I don't see anything Oracle in your question. It looks like you're getting an error using Microsoft's SQL Server driver, did you mean to post this to a forum on Microsoft's site perhaps? -
BO XI 3.1 in Webi Rich Client, i get this when I use the default Audit Universe to run the Sample Auditing Report.
A database error occured. The database error text is: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) Could not prepared..(WIS 10901)
In infoview webi i get this,
A Database error occured. The database error text is: [Microsoft][ODBC driver Manager] Data source name not found and no default driver specified. (WIS 10901)
We tried checking all the rights and we are trying this using the Administrator user. Also tried logon to Desinger, Import Auditing Universe and Verify the Parameters and then re exported. Still not workingHi Prasanth,
Thanks for your suggestions and I tried all that what I can do along with your suggestion, and still getting the same error, all the connection are working fine, but when I checked for Integrity, Parse Object and Cardinality I was getting some Object error and cardinality error, which am trying to resolve, so I think am having a wrong version of the Activity Universe.
Thanks for your suggestion.
Thanks and Regards
Senthil -
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
Hi , i am trying to execute siple SP using JDBC-ODBC Bridge Driver
Here my code :
String dsn="Tritek1";
String user="sa";
String password="imcindia";
Connection con1 = null;
CallableStatement cstmt = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
con1=DriverManager.getConnection("jdbc:odbc:"+dsn,user,password);
Statement st=con1.createStatement();
st.execute("use dm0102d");
st.execute("setuser 'dm01012'");
cstmt = conObject.connection(" ?=Call dms_ex_get_folder_info(?,?,?)");
cstmt.setString(1,folderType);
cstmt.registerOutParameter(2,java.sql.Types.VARCHAR);
cstmt.registerOutParameter(3,java.sql.Types.VARCHAR); bFlag=cstmt.execute();
Here my SP :
Procedure Name : dms_ex_get_folder_info
Input Parameter(s) : a. folder_type char(20)
Return Parameter(s) : a. Recordset consist edit_mask and folder_type_code from folder_reference table / error
Procedure Type : select
Programmer : Prashanth Kumar M.
Creation Date : 12/20/2005 (20th Dec, 2005)
Tables Accessed : folder_reference
Revised :
Programmer: Date: Description:
Prashanth Kumar M. 12/21/2005 Modified the script as per the approved program specifications.
Test Query:
Declare @edit_mask char(15)
Declare @folder_type_code char(2)
execute dms_ex_get_folder_info 'Policy Folder',@edit_mask output,@folder_type_code output
Print 'Edit Mask : ' + @edit_mask
Print 'Folder Type Code : ' + @folder_type_code
CREATE PROCEDURE dms_ex_get_folder_info
@folder_type char(20),
@edit_mask char(15) output,
@folder_type_code char(2) output
AS
BEGIN
-- Check if the record for @folder_type exists or not.
BEGIN
-- return the record from folder_reference
SELECT
@edit_mask= IsNull(edit_mask,''),
@folder_type_code = IsNull(folder_type_code,'')
FROM folder_reference
WHERE
folder_decode = ltrim(rtrim(@folder_type))
-- return the error message
IF @@error <> 0
BEGIN
RAISERROR 100016 'Error in gettting the record from folder_reference table'
RETURN (@@error)
END
IF @edit_mask = '' AND @folder_type_code = ''
BEGIN
RAISERROR 100017 'No matching details in the folder_reference table'
RETURN (@@error)
END
END
END
GO
Here My Exception:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
at com.nyl.dms.bl.Folder.createFolder(Folder.java:121)
at com.nyl.dms.bl.Folder.main(Folder.java:223)
Any one can help me to overcome this problem . Thanks in advance.
venkatHere's from one of those 10s of books.
Quoted from JDBC 3.0 by Bernard Van Haecke:
Stored procedures can return multiple result types because they can be composed of SQL statements that return diverse result types: resultsets and update counts (this includes special error codes).
Now this doesn't sound very satisfactory. So I use Sybase since I don't have any other database at the moment, and write a simple stored procedure.
CREATE proc testproc AS
BEGIN
-- My return code
return 7
END
goThen a sample patchy buggy code to play around:
import java.sql.*;
public class ProcTesting {
public static void main(String[] args) {
String connUrl = "jdbc:sybase:Tds:myserver:5150/dbinst";
String userName = "username";
String password = "password";
Connection con = null;
CallableStatement stmt = null;
ResultSet rs = null;
String sql = "{? = call testproc}";
try {
Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
con = DriverManager.getConnection(connUrl, userName, password);
stmt = con.prepareCall(sql);
stmt.registerOutParameter(1, Types.INTEGER);
stmt.execute();
System.out.println(stmt.getInt(1));
} catch(Exception e) {
e.printStackTrace();
} finally {
closeAll(con, stmt);
public static void closeAll(Connection con, Statement stmt) {
try {
con.close();
} catch(Exception e) { }
try {
stmt.close();
} catch(Exception e) { }
}Followed by:
javac ProcTesting.java
java -cp "%CLASSPATH%;C:\jarutils\jconn2.jar" ProcTesting
Output:
7
Didn't you know this could be done?
Happy new year, grandpa! -
Hi, I've seen questions about this error posted elsewhere but I'm not sure if the same issues applied.
I'm trying to connect to SQL Server from a VBA macro in excel. I've managed to do this with the code below where my query is return to cells in my active worksheet but for another query I want to run the data to be return is too large for Excel to handle
and so I'd like to save it as a .csv file but using the second example of my code I get the message "[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied". Since I have access to this database from the first example
of the code, I assume my conn.ConnectionString line of code is letting me down.
Can anyone help me please?
'Code to return data to worksheet'
Sub macro2()
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DSN=SQLRA - OPENBET;UID=user1;Trusted_Connection=Yes;APP=Microsoft Office 2013;WSID=pdfdf3001;DATABASE=open;Network=DBMSS" _
), Array("OCN;Address=SQLRA_DB,55455;ApplicationIntent=READONLY;")), _
Destination:=Range("$BG$1")).QueryTable
.CommandText = Array( _
"select A.ev_oc_id, B.ev_mkt_id, A.ev_id, D.start_Time, Upper(Replace(A.[desc],'|','')) , A.result, COALESCE(A.sp_num, A.lp_num) , ", _
"COALESCE(A.sp_Den, A.lp_Den) from open.reporting.tevoc A, open.reporting.tevmkt B, open.reporting.tevocgrp C, open.reporting.tev D ", _
"where A.ev_mkt_id = B.ev_mkt_id and B.ev_oc_grp_id = C.ev_oc_grp_id and D.ev_id = A.ev_id and Upper(Replace(D.[desc],'|','')) = 'home' and upper(B.name) = '|today|' and D.ev_type_id in (264, 289) and D.ev_class_id = 49
and D.start>= '" & Year & "-" & Month & "-" & Day & "'" _
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table_Query_from_SQLRA___OPEN_1"
.Refresh BackgroundQuery:=False
End With
End Sub
'Code that produces error'
Sub macro1()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim testSQL As String
Dim qd As DAO.QueryDef
Dim openbetdb As Database
conn.ConnectionString = "driver={SQL Server}; server= sqlra_db;uid=user1;APP=Microsoft Office 2013;WSID=pdfdf3001;database=openbet"
conn.Open
testSQL = "SELECT * FROM open.reporting.TevType where ev_class_id = 49 and ev_type_id in(289,330,518,13492);"
Set qd = Db.CreateQueryDef("tmpExport", testSQL)
DoCmd.TransferText acExportDelim, , "tmpExport", "C:\\export.csv"
End SubHello,
Are you connect to remote SQL Server? If so,
please make sure the target SQL Server is running and is listening on appropriate protocols. Please take a look at the following article about general steps to troubleshoot
SQL connectivity issues:
http://blogs.msdn.com/b/sql_protocols/archive/2008/04/30/steps-to-troubleshoot-connectivity-issues.aspx
Regards,
Elvis Long
TechNet Community Support
Maybe you are looking for
-
10g Physical Standby to be used for Backup through RMAN
Dear All, I have 10g Database Primary and Standby Server which is operating in Maximum Performance Mode. I want to use Standby Database for performing Weekly Full and Daily Incremental Backups through RMAN. Kindly inform me is it possible, if yes how
-
HT204023 I lost my personal hotspot where can I get it back?
I lost my personal hotspot where can I get it back? Been using in the past few days and this morning it just disappear
-
Shipment with Syncreon and UKMail
Hi, I have ordered an iPod Classic and tried to track the delivery. Apple states it has been dispatched with Snyncreon post, which distributes either to UKMail or UPS. My tracking number should work with on one of the two comapnies websites to keep u
-
Showing arabic numbers in standard reports
Hi, we are using oracle applications 11i and i was wondering if is there any possible way to show numbers in standard reports as Arabic numbers..... regards, Ahmed Alsayed
-
Help! Replacing parts of PHP files
My apologies if this is a dumb question. I'm trying to copy a file and change a a small section of that file. How can I change that small section? I tried doing so with by converting the byte array into a string, but how do you convert a string back