DescriptorException: field type mismatch
We are facing a typical exception when trying to fetch a XMLType field.
We are using toplink 9.0.4 version on Websphere 5.0
We have defined a model class with one variable of the class defined as XMLType and mapped that field to the underlying db field which is of XMLType type.
When we test the code to fetch the persistent objects with XMLType variables on JBuilder it works fine without giving any issues.
But when we deploy the application on to Websphere we get an error shown below:
In the below exception "m_defaultExpression" is the variable of type XMLType.
Can you please let us know what can be the possible difference running on JBuilder and Websphere??
One and only one difference which we could see was the JVM version. On JBuilder its 1.4.1 and websphere is on 1.3.1 JVM version. Not sure if this brings any difference in the working of toplink 9.0.4 runtime API.
Exception [TOPLINK-32] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.DescriptorException
Exception Description: Trying to set value [<?xml version="1.0"?><Condition></Condition>] for instance variable [m_defaultExpression] of type [oracle.xdb.XMLType] in the object. The specified object is not an instance of the class or interface declaring the underlying field, or an unwrapping conversion has failed.
Internal Exception: java.lang.IllegalArgumentException: field type mismatch
Mapping: oracle.toplink.mappings.DirectToFieldMapping[m_defaultExpression-->SOURCE_OBJECT_ATTRIBUTE_MAP.DEFAULT_EXPRESSION]
Descriptor: Descriptor(com.fmrco.ios.gppas.metadata.model.SourceAttribute --> [DatabaseTable(SOURCE_OBJECT_ATTRIBUTE_MAP)])
at oracle.toplink.exceptions.DescriptorException.illegalArgumentWhileSettingValueThruInstanceVariableAccessor(DescriptorException.java:532)
at oracle.toplink.internal.descriptors.InstanceVariableAttributeAccessor.setAttributeValueInObject(InstanceVariableAttributeAccessor.java:125)
at oracle.toplink.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:950)
at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:861)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:164)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:331)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:387)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.buildObjectsFromRows(DatabaseQueryMechanism.java:146)
at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:422)
at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:498)
at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:111)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1968)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1096)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1048)
at com.fmrco.ios.gppas.metadata.model.MetadataSession.findAttributeDefinitions(MetadataSession.java:537)
at com.fmrco.ios.gppas.metadata.MetadataDAOImpl.fetchAttributeDefinitions(MetadataDAOImpl.java:488)
at com.fmrco.ios.gppas.entity.etcdao.EntityEtcDAO.fetchAllAttributeDefinitions(EntityEtcDAO.java:156)
at com.fmrco.ios.gppas.entity.engine.EntityEngine.fetchAllAttributeDefinitions(EntityEngine.java:125)
at com.fmrco.ios.gppas.manager.EntityManagerEJB.fetchAllAttributeDefinitions(EntityManagerEJB.java:231)
at com.fmrco.ios.gppas.manager.EJSLocalStatelessEntityManager_ee7411f8.fetchAllAttributeDefinitions(Unknown Source)
at com.fmrco.ios.gppas.gems.request.RequestSFEJB.getRequestSearchAttributes(RequestSFEJB.java:433)
at com.fmrco.ios.gppas.gems.request.EJSRemoteStatelessRequestSF_5518517c.getRequestSearchAttributes(Unknown Source)
at com.fmrco.ios.gppas.gems.request._RequestSFRemote_Stub.getRequestSearchAttributes(Unknown Source)
at com.fmrco.ios.gppas.gems.request.RequestBD.getRequestSearchAttributes(RequestBD.java:217)
at com.fmrco.ios.gppas.gems.action.SearchAction.execute(SearchAction.java:139)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:923)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:528)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:516)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:366)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Internal Exception Stack:
java.lang.IllegalArgumentException: field type mismatch
at java.lang.reflect.Field.set(Native Method)
at oracle.toplink.internal.descriptors.InstanceVariableAttributeAccessor.setAttributeValueInObject(InstanceVariableAttributeAccessor.java:106)
at oracle.toplink.mappings.DatabaseMapping.setAttributeValueInObject(DatabaseMapping.java:950)
at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:861)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:164)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:331)
at oracle.toplink.internal.descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:387)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.buildObjectsFromRows(DatabaseQueryMechanism.java:146)
at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:422)
at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:498)
at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:111)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1968)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1096)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1048)
at com.fmrco.ios.gppas.metadata.model.MetadataSession.findAttributeDefinitions(MetadataSession.java:537)
at com.fmrco.ios.gppas.metadata.MetadataDAOImpl.fetchAttributeDefinitions(MetadataDAOImpl.java:488)
at com.fmrco.ios.gppas.entity.etcdao.EntityEtcDAO.fetchAllAttributeDefinitions(EntityEtcDAO.java:156)
at com.fmrco.ios.gppas.entity.engine.EntityEngine.fetchAllAttributeDefinitions(EntityEngine.java:125)
at com.fmrco.ios.gppas.manager.EntityManagerEJB.fetchAllAttributeDefinitions(EntityManagerEJB.java:231)
at com.fmrco.ios.gppas.manager.EJSLocalStatelessEntityManager_ee7411f8.fetchAllAttributeDefinitions(Unknown Source)
at com.fmrco.ios.gppas.gems.request.RequestSFEJB.getRequestSearchAttributes(RequestSFEJB.java:433)
at com.fmrco.ios.gppas.gems.request.EJSRemoteStatelessRequestSF_5518517c.getRequestSearchAttributes(Unknown Source)
at com.fmrco.ios.gppas.gems.request._RequestSFRemote_Stub.getRequestSearchAttributes(Unknown Source)
at com.fmrco.ios.gppas.gems.request.RequestBD.getRequestSearchAttributes(RequestBD.java:217)
at com.fmrco.ios.gppas.gems.action.SearchAction.execute(SearchAction.java:139)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:923)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:528)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:516)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:366)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Are you using the same database and JDBC drivers in WebSphere? This seems to me to be the likely problem -- in JDeveloper you've coded for the JDBC driver to return the oracle.xdb.XMLType, and in WebSphere you have a different JDBC driver and it's somehow returning something different.
One note is that in developer preview 2 for 10.0.3 on OTN we actually have better and more explicit mapping control to the XMLType (i.e., you make it a Document in your object model). You might want to play with that at some point.
As for your current situation, all I can suggest is to open your source.zip file for TopLink (it's in the jlib director with your other jars), and handle the situation in the ConversionManager.java class (in other words, you will need to experiement and check what types are coming back from each of the drivers and then write code to behave how you'd like).
- Don
Similar Messages
-
Data type mismatch when inserting into text field
Hello all,
Using VB script and ASP.
I have a page that inserts into a field (casenum) in a table (clientsw) in a database. The field (casenum) in the table is data type TEXT :
I create a recordset and then an insert statement which the following is part of:
Code to insert the casenum into the field
rsClients("Casenum")=Right(Date(),2) & "E-100" & rsCasenumber("countervalue")
It inserts a number like 09E-1004500
I then have code that takes that string and passes it to the next page as a variable
Session("UserID")=rsClients("CASENUM")
response.redirect "done3.asp"
When it gets to the next page it is assigned as UserID
Dim svuserid
svuserid = "0"
if (Session("UserID") <> "") then svuserid = Session("UserID")
%>
My information inserts into the database exactly as I want it, but when it gets to the next page I get an error that is displayed that says the following:
Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
/done3.asp, line 16
My code on the second page is as follows:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connNewdatabase1.asp" -->
<%
Dim svuserid
svuserid = "0"
if (Session("UserID") <> "") then svuserid = Session("UserID")
%>
<%
set rsClients = Server.CreateObject("ADODB.Recordset")
rsClients.ActiveConnection = MM_connNewdatabase_STRING
rsClients.Source = "SELECT * FROM CLIENTSW WHERE CASENUM=" + Replace(svuserid, "'", "''") + " ORDER BY CASENUM"
rsClients.CursorType = 0
rsClients.CursorLocation = 2
rsClients.LockType = 3
rsClients.Open()
rsClients_numRows = 0
%>
Line 16 is the one that says rsClients.Open()
If I take the concatenation out of rsClients("Casenum")=Right(Date(),2) & "E-100" & rsCasenumber("countervalue") and have only rsClients("Casenum")=rsCasenumber("countervalue") and change the table field to number, I don't get the "datatype mismatch error"
What do I change to enable me to leave the above statement concatenated and insert into the table correctly and complete the stuff on the next page?>This is an access database, varchar is not an option for a datatype.
Sorry. In another thread I thought you mentioned using SQL Server
>I changed the + signed to ampersands instead and it doesn't make a difference.
I didn't think that was the problem. I was just pointing out that it's a bad practice. If you use the '+' on two strings that can evaluate as numeric, it will actually add rather than concat them. -
"Type mismatch" error in IE7/8 when using custom Actions Menu Image
Hi all,
in APEX 4.2: when using a custom image in the "Actions Menu Image" attribute in an interactive report, I get a "Type mismatch" error in IE7/8 when refreshing the report through PPR (filtering, sorting, paginating etc.). When I leave the "Actions Menu Image" field empty, everything works fine. The error doesn't seem to happen in IE9 (unless using compatibility mode), or in any non-IE browser.
I've been able to reproduce the issue in an application on apex.oracle.com:
http://apex.oracle.com/pls/apex/f?p=69347:1
Some debugging seems to indicate that the following line in widget.interactiveReport.js is the culprit:
lTemp.parentNode.replaceChild($x('apexir_WORKSHEET'), lTemp);Does anybody know if this is a known issue, or if there is some workaround?
Thanks,
TobiasHi,
Great solution Paul! It cost me a while before I found out the Action Menu Image was causing my interactive reports to stop refreshing in IE10 and not other browsers. Your solution works great, I've implemented it with a few minor adjustments:
- Put the css in report template (for some reason it didn't work in our own application stylesheet)
- replace 'url("/c/action_dropdown.gif")' with 'url("&APP_IMAGE_PREFIX./<path_to_image>")'
- place one dynamic action on page 0: after refresh of '#apexir_DATA_PANEL' , set event scope to "Dynamic".
- Let the Dynamic action also fire on page load.
- To make sure the dynamic action only works for pages with an interactive report add condition of type 'Exists' with expression:
select 1
from dual
where :APP_PAGE_ID in (select page_id
from apex_application_page_ir
where application_id = :APP_ID
Best regards,
Vincent Deelen -
Type mismatch when calling gui_download
Hello experts
i written a test gui upload and downlaod program . program gives run time error saying type mismatch in function call gui_download .
REPORT ZCR_UPLOAD_DOWNLOAD .
TABLES: SSCRFIELDS.
TYPES: BEGIN OF TY_STUDENT,
ID TYPE ZSTUDENTDATA1-ID,
NAME TYPE ZSTUDENTDATA1-NAME,
COURSE TYPE ZSTUDENTDATA1-COURSE,
DOJ TYPE ZSTUDENTDATA1-DOJ,
ADDRESS TYPE ZSTUDENTDATA1-ADDRESS,
END OF TY_STUDENT.
DATA : IT_STUDENT TYPE TABLE OF TY_STUDENT,
WA_STUDENT TYPE TY_STUDENT.
DATA : FILE_NAME TYPE IBIPPARMS-PATH.
selection-screen BEGIN OF BLOCK BK1 WITH FRAME TITLE TXT-001.
PARAMETERS : P_FILE(30) TYPE C.
PARAMETERS: UPLOAD RADIOBUTTON GROUP rad DEFAULT 'X',
DOWNLOAD RADIOBUTTON GROUP rad.
SELECTION-SCREEN END OF BLOCK BK1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
FILE_NAME = P_FILE.
CALL FUNCTION 'F4_FILENAME'
* EXPORTING
* PROGRAM_NAME = SYST-CPROG
* DYNPRO_NUMBER = SYST-DYNNR
* FIELD_NAME = ' '
IMPORTING
FILE_NAME = FILE_NAME.
START-OF-SELECTION.
IF UPLOAD = 'X'.
PERFORM GUI_UPLOAD.
ELSE.
PERFORM DATA_RETRIEVE.
PERFORM GUI_DOWNLOAD.
ENDIF.
FORM GUI_UPLOAD .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE_NAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '#'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = IT_STUDENT
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
UPDATE ZSTUDENTDATA1 FROM TABLE IT_STUDENT.
ENDFORM. " GUI_UPLOAD
FORM DATA_RETRIEVE .
SELECT ID
NAME
COURSE
DOJ
ADDRESS
INTO TABLE IT_STUDENT FROM ZSTUDENTDATA1.
ENDFORM. " DATA_RETRIEVEHello sir
Thanks for quick response.
At first i declared same data type as filename field of FM f4_filename so i declare
DATA : FILE_NAME TYPE IBIPPARMS-PATH.
at selection screen the data type is
PARAMETERS : P_FILE(30) TYPE C.
then i assigned to FILE_NAME
NOW i am assignig field FILENAME of gui_download to it but the data type of filename is string . should i covert the type of
FILE_NAME TO STRING BEFORE ASSIGNING THE VALUE PLEASE SUGGEST.
THANKS IN ADVANCE
CHITTA RANJAN MAHATO -
Type mismatch error when compile under v. 10 from 8
We have an old report done about 2005, now we found a bug, so I need to fix it, but after I changed and compiled it(Vb6 app). Just error out with type mismatch.
I checked that I need to change the vb project reference to 10, and component to 10
Still does not work.
Any one can suggest?
Thanks.
GregAlso one more thing, does crytal tells more information about which field caused "type mismatch"?
I am trying to creat a new report in 10, and add field one by one, but then I got another error saying "This field name is not known", is there any place I can find which field crytal is complaining from "Crytal Report Viewer". I just can not believe crytal is giving such unclear message. It should say "xxxx field name is not known".
Also, I tried to input old report(8) into new (10), then saying database changed needs to fix report, after fixes, apparently it caused type mismatch, is there a way to see which fields it fixed?
Thanks.
Greg
Edited by: greg chu on Dec 5, 2008 3:48 PM -
Data type mismatch in criteria expression. What am I not seeing??
Once again I'm stuck! I have included the query I'm trying to run below. I have also indicated the data types of my fields.
<cfquery name="qGetOrders" datasource="manna_premier">
SELECT DISTINCT Count(ID) AS CountOfID, - number
TMName, -text
Sum(Quantity) AS SumOfQuantity, - number
Count(NewExisting) AS CountOfNewExisting -number
FROM Users, Orders, ProductOrders
WHERE SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)#
GROUP BY UserZone, TMName
</cfquery>
When run it returns this error message....
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
The error occurred in D:\Inetpub\mannapremier\zvp_report2.cfm: line 11
9 : Count(NewExisting) AS CountOfNewExisting
10 : FROM Users, Orders, ProductOrders
11 : WHERE SaleDate BETWEEN #CreateODBCDate(FORM.Start)# AND #CreateODBCDate(FORM.End)#
12 : GROUP BY UserZone, TMName
13 : </cfquery>
SQLSTATE
22018
SQL
SELECT DISTINCT Count(ID) AS CountOfID, TMName, Sum(Quantity) AS SumOfQuantity, Count(NewExisting) AS CountOfNewExisting FROM Users, Orders, ProductOrders WHERE SaleDate BETWEEN {d '2009-10-01'} AND {d '2009-10-31'} GROUP BY UserZone, TMName
VENDORERRORCODE
-3030
DATASOURCE
manna_premier
I use the where clause on several other pages and it works. I don't understand where my data type is mismatched.
Can anyone point me in the right direction?4) If you indeed need to select from the 3 tables Users,
Orders, ProductOrders, then you should qualify the columns
names like this, Users.ID, productOrders.Quantity, and so
on.
You also need to join on the related columns. If you forget to do that the resultset will be a massive cartesian table (huge number of records):
rows in Table1 * #rows in Table2 * #rows in Table3 -
Hi,
I have a file where fields are wrapped with ".
=========== file sample
"asdsa","asdsadasdas","1123"
"asdsa","asdsadasdas","1123"
"asdsa","asdsadasdas","1123"
"asdsa","asdsadasdas","1123"
==========
I am having a .net method to remove the wrap characters and write out a file without wrap characters.
======================
asdsa,asdsadasdas,1123
asdsa,asdsadasdas,1123
asdsa,asdsadasdas,1123
asdsa,asdsadasdas,1123
======================
the .net code is here.
========================================
public static string RemoveCharacter(string sFileName, char cRemoveChar)
object objLock = new object();
//VirtualStream objInputStream = null;
//VirtualStream objOutStream = null;
FileStream objInputFile = null, objOutFile = null;
lock(objLock)
try
objInputFile = new FileStream(sFileName, FileMode.Open);
//objInputStream = new VirtualStream(objInputFile);
objOutFile = new FileStream(sFileName.Substring(0, sFileName.LastIndexOf('\\')) + "\\" + Guid.NewGuid().ToString(), FileMode.Create);
//objOutStream = new VirtualStream(objOutFile);
int nByteRead;
while ((nByteRead = objInputFile.ReadByte()) != -1)
if (nByteRead != (int)cRemoveChar)
objOutFile.WriteByte((byte)nByteRead);
finally
objInputFile.Close();
objOutFile.Close();
return sFileName.Substring(0, sFileName.LastIndexOf('\\')) + "\\" + Guid.NewGuid().ToString();
==================================
however when I run the bulk load utility I get the error
=======================================
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 3 (NumberOfMultipleMatches).
==========================================
the bulk insert statement is as follows
=========================================
BULK INSERT Temp
FROM '<file name>' WITH
FIELDTERMINATOR = ','
, KEEPNULLS
==========================================
Does anybody know what is happening and what needs to be done ?
PLEASE HELP
Thanks in advance
VikramTo load that file with BULK INSERT, use this format file:
9.0
4
1 SQLCHAR 0 0 "\"" 0 "" ""
2 SQLCHAR 0 0 "\",\"" 1 col1 Latin1_General_CI_AS
3 SQLCHAR 0 0 "\",\"" 2 col2 Latin1_General_CI_AS
4 SQLCHAR 0 0 "\"\r\n" 3 col3 Latin1_General_CI_AS
Note that the format file defines four fields while the fileonly seems to have three. The format file defines an empty field before the first quote.
Or, since you already have a .NET program, use a stored procedure with table-valued parameter instead. I have an example of how to do this here:
http://www.sommarskog.se/arrays-in-sql-2008.html
Erland Sommarskog, SQL Server MVP, [email protected] -
This is a post from yesterday that spiraled down the wrong track.
I have this line
s.execute("SELECT * FROM Packlists WHERE Packlist = '" + plNum + "'");
where plNum is an int. I have also tried long, short, double, etc. I always get a type mismatch error though. I have tried substituting real values for the variable. Packlist is a Long Integer field in an Access databases.execute("SELECT * FROM Packlists WHERE Packlist = " + plNum);
-
Hello:
I have an sql query that works just fine when I run it
directly in Access but when I run it on a web site, it gives me an
error "Data type mismatch in criteria expression".
I am working with transactions and this is an update of a
table within a transaction.
Here is the code:
con.execute "UPDATE tblWells SET API_Number='" &
Request.Form("API_Number") & "', Well_Name='" &
Request.Form("Well_Name") & "', Drill='" &
Request.Form("Drill") & "', Reenter='" &
Request.Form("Reenter") & "', horizontal='" &
Request.Form("horizontal")& "', Duration='" &
Request.Form("Duration") & "', OilWell='" &
Request.Form("OilWell") & "', GasWell='" &
Request.Form("GasWell") & "', Other='" &
Request.Form("Other") & "', SingleZone='" &
Request.Form("SingleZone") & "', MultipleZone='" &
Request.Form("MultipleZone")& "', NumAcresLease='" &
Request.Form("NumAcresLease") & "', LeaseSerialNumber='" &
Request.Form("LeaseSerialNumber") & "', LeaseName='" &
Request.Form("LeaseName") & "', WellNumber='" &
Request.Form("WellNumber") & "', state='" &
Request.Form("state") & "', county='" &
Request.Form("county") & "', wellheadElevation='" &
Request.Form("wellheadElevation") & "', groundElevation='"
& Request.Form("groundElevation") & "', ProposedDepth='"
& Request.Form("ProposedDepth") & "',
DistanceTownPostOffice='" &
Request.Form("DistanceTownPostOffice") & "',
DirectionTownPostOffice='" &
Request.Form("DirectionTownPostOffice") & "',
Distance_Nearest_Property_Line='" &
Request.Form("Distance_Nearest_Property_Line") & "',
DistanceNearestWell='" & Request.Form("DistanceNearestWell")
& "', UnitSpacing='" & Request.Form("UnitSpacing") & "'
WHERE WellID=1"
I can't figure why the query would work fine in Access and
not on the webpage.
Thanks.A Checkbox does not exist as a form value if it empty which
is why your SQL
script is failing. What you need to do is create a variable
and then assign
it with the value. Assuming you are using ASP then taking one
element on
your SQL statement
SingleZone='" & Request.Form("SingleZone")
you would change it to
SingleZone = strSingleZone
Above the actual start of your SQL statement you would define
your variables
and set their empty values, and then assign them to the form
values
Dim strSingleZone = 0
if Request.Form("SingleZone") <> "" then
strSingleZone = Request.Form("SingleZone")
End if
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"zavidp" <[email protected]> wrote in
message
news:eo9554$dd0$[email protected]..
> Okay, I have worked further. I have isolated the fields
that are causing
> trouble and they are checkbox fields.
>
> I have been pulling my hair out all day trying to figure
out how to set
> access
> and asp so that the on/off, true/false or whatever is
passed correctly.
>
> Can anyone help?
>
> Dave
> -
Data type mismatch while writing a code in BADi
Hi Experts,
While writing a code in BADi, I am facing data type mismatch.
Scenario:
I have created the Infospoke based on one ODS and inside BADi i am looking up the other ODS fields.
Two ODS's having 4 common key fields but one key field having the data type mismatch.
While selecting the data from other ODS table in where condition it's giving the error data type mismatch.
Could you please advice the same please.
Thanks.
Gana.Any update please....
Thanks in advance.
Edited by: Gananadha Lenka on Jun 18, 2010 1:57 PM -
Data Type mismatch in for all entries.
Dear Friends,
I have a problem...please advice me for that..... I m using code as following...actually the isse is when ever i am using
WHERE docno = it_j_1iexchdr-rdoc (along with FOR ALL ENTRIES IN) the error is occured data type mismatch.
becoz DOCNO is field of(j_1iexchdr) and RDOC is a character field of same table...but i want to get reference data..so i need to compare both field...u can undersdand my requirement in following coding.. Error line is denoted by (<----
DATA: BEGIN OF it_j_1iexchdr OCCURS 0,
bukrs LIKE j_1iexchdr-bukrs, " Company Code.
exnum LIKE j_1iexchdr-exnum, " Excise Invoice No.
exdat LIKE j_1iexchdr-exdat, " Excise Invoice Dt.
kunag LIKE j_1iexchdr-kunag, " Sold-to-party
kunwe LIKE j_1iexchdr-kunwe, " Ship-to-party
rdoc LIKE j_1iexchdr-rdoc,
rdoc TYPE j_1iexchdr-docno,
addldata1 LIKE j_1iexchdr-addldata1, " Reason for Issueing Excise Invoice
exbed LIKE j_1iexchdr-exbed, " Excise Duty
ecs LIKE j_1iexchdr-ecs, " 2%Cess
exaddtax1 LIKE j_1iexchdr-exaddtax1, " Shec
trntyp LIKE j_1iexchdr-trntyp, " OTHR
END OF it_j_1iexchdr.
DATA: wa_j_1iexchdr LIKE it_j_1iexchdr.
DATA: BEGIN OF it_j_1iexchdr1 OCCURS 0,
trntyp LIKE j_1iexchdr-trntyp,
docno LIKE j_1iexchdr-rdoc,
rdoc LIKE j_1iexchdr-rdoc,
END OF it_j_1iexchdr1.
DATA: wa_j_1iexchdr1 LIKE it_j_1iexchdr1.
SELECT bukrs exnum exdat kunag kunwe rdoc
addldata1 exbed ecs exaddtax1 trntyp
FROM j_1iexchdr
INTO CORRESPONDING FIELDS OF TABLE it_j_1iexchdr
WHERE bukrs IN v_bukrs
AND exdat IN v_exdat
AND trntyp = 'OTHR'.
IF it_j_1iexchdr[] IS NOT INITIAL.
SELECT trntyp docno rdoc
FROM j_1iexchdr
INTO CORRESPONDING FIELDS OF table it_j_1iexchdr1
FOR ALL ENTRIES IN it_j_1iexchdr
WHERE docno = it_j_1iexchdr-rdoc <----
I
AND trntyp = 'DLFC'.
ENDIF.
Pl help me as soon as possible...
Thanks & Regards,
Swapnika PanseHi,
In table j_1iexchdr, there are two fields
RDOC J_1IRDOC1 CHAR 10 Reference Document 1
DOCNO J_1IDOCNO NUMC 10 Internal Excise Document Number
RDOC is of character type and DOCNO is of numeric type.
Your declaration for fields is :
docno LIKE j_1iexchdr-rdoc,
rdoc LIKE j_1iexchdr-rdoc,
And in the select query you are trying to fetch docno which is of type j_1iexchdr-rdoc. SO, change your declaration from
docno LIKE j_1iexchdr-rdoc,
to
docno LIKE j_1iexchdr-docno,
This should solve your problem.
Thanks,
Archana -
SQL Insert Statement Data Type Mismatch Error
I am doing a very simple web application that has a Microsoft Access database as the data source. I have been able to sucessfully create update and query statements using parameters but am having issues with an insert statement. I am using JSTL 1.1.2
The following code creates the data type mismatch error.
<sql:update
sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
<sql:param value='$(ID}'/>
<sql:param value='${feature}'/>
</sql:update>The table has NUMBER as the data type for both of these fields and the variables I am feeding into it are both numbers. If I hard code the first number into the sql statement then it works. I have tried swapping the variables around and as long as the first one is hard coded the parameter for the second one works no matter which is first or second.
However I can get the following code to work, which of course leaves me vulnerable to sql injection attacks which is not really a good thing.
<sql:update>
insert into tblTtoF(TFToolID,TFFeatID) values('<c:out value="${ID}"/>','<c:out value="${feature}"/>')
</sql:update>So I am just looking for any suggestions as to why my first piece of code doesn't work seeing as it is the simplest of SQL statements and the most standard syntax.
ThanksI changed it to the following
<c:set var="featurenew" value="${0 + feature}"/>
<c:set var="IDnew" value="${0 + param.toolID}"/>
<sql:update
sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
<sql:param value='$(IDnew}'/>
<sql:param value='${featurenew}'/>
</sql:update>And got the following error in the localhost.log
31/07/2006 09:31:41 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1437)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1072)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1063)
at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.setParameters(UpdateTagSupport.java:254)
at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doEndTag(UpdateTagSupport.java:156)
at org.apache.jsp.dataUpdated_jsp._jspx_meth_sql_update_1(dataUpdated_jsp.java:975)
at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_if_0(dataUpdated_jsp.java:879)
at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_forEach_0(dataUpdated_jsp.java:680)
at org.apache.jsp.dataUpdated_jsp._jspService(dataUpdated_jsp.java:151)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
at java.lang.Thread.run(Thread.java:595)
I have also tried the following in the past with no luck
<fmt:parseNumber value="${ID}" type="number" var="IDnew"/>
AND......
<sql:query
sql="select TFToolID from tblTtoF where TFToolID = ?"
var="toolresults">
<sql:param value="${ID}"/>
</sql:query>
<c:forEach var="getID" items="${toolresults.rows}">
<c:set var="theID" value="${getID.TFToolID}"/>
</c:forEach>
AND when that didn't work, added this....
<fmt:parseNumber value="${theID}" var="IDnew"/> -
Getting validation error "argument type mismatch"
I have 2 dropdowns and submit button in jspx page. jspx page has corresponding backing bean with respective properties. When I select values in dropdowns and hit submit I am getting redirected to same page with validation error "argument type mismatch" beneath the dropdowns.
Kate, I bet there is more to the error than you have given here. If I were a betting man I would say it has something to do with the difference between a jbo Number type and the java Number type. I have run into this particular problem twice before. Basically the oracle jbo Number type is not compatible or automatically caste-able into a java type Number. So, perhaps in your backing bean, you have some thing that is defined as a Number in one of jdeveloper's declaritive fields (jbo Number) and in a java program somewhere you have probably declared a variable as just plain-old Number which is a different class...coming from Java's built-in types classes.
Hope that's your problem, and I hope this helps.
Michael F. -
Hello,
I am using Teststand with LV for wafer level testing and writing the results through an Arendar API to a SQL server database. The Arendar API provides custom step types to access and write data to the database directly from the TS sequence. The database field properties can be set as double precision, integer, string and date. I have not been able to write integer or date strings to the database from Teststand. Double precision and string values written to database double and string fields work fine. Arendar can accept formatted strings for date entries. I believe this has something to do with the TS variable formatting as I can write all field types to the Arendar DB using other data import methods. Below is the type mismatch error I get. I'm looking for any suggestions on possible staion settings or variable flag settings that might affect this issue. I know TS does not support native integer or date formats so I think fixing one will fix them both.
Error:
The .NET method 'ArendarTS_WriteProductTest' threw an exception.
Value type does not match the property's data type.
Parameter name: value Source: ArendarClient
at VITechnology.Arendar.TestData.TestProperty.SetValue(Object value)
at VITechnology.Arendar.TestData.TestProperty.set_Value(Object value)
at NiArendarIntegration.NIArendarIntegration.Arendar_SetProductTestProperties(ProductTest pt, String[] productTestPropertyNames, Object[] productTestPropertyValues)
at TestStandArendar2007.TestStandArendar.ArendarTS_WriteProductTest(SequenceContext seqContext, ProductTest pt, String[] fieldNames, String[] fieldValues)
[Error Code: -17500]
Thanks for the help.
MikeIt turns out this problem exists when using TestStand 4.0 and Arendar 2007 (V4.0). VI-Tech fixed the problem in Arendar V4.1. I'm not sure yet if this function works whith TestStand V4.0 and Arendar V4.1. I posted this as VI-Tech had been working on this awhile as was I. VI-Tech responded as to the root of the problem just hours after I posted. Hmmm....
Thanks for your input.
Mike -
Type Mismatch error while saving a BPC Report using eTools
Hi,
Iam getting a 'type mismatch' error when trying to save a BPC Excel workbook using eTools>Save Dynamic Template >Company>eExcel. I am saving it as an .xlsx file.
Can anyone please help out and let me know why I am getting this error.
Thanks
ArvindHi,
You need to save the file as .xls extension.
Maybe you are looking for
-
How do i resize my hard drive without erasing data
i have OS X 10.10.1 and i also dual boot my mac with windows 8.1. i have a 750 gb hard drive & on my windows partition i have 105 gb of free space but on my mac partition i have only 50 gb free
-
when trying to send emails on my Iphone i get the message email rejected by server because it does not allow relaying can anyone help me with this problem
-
How come I get no sound when I attach hdmi cable from new macbook to tv?
i have attached an hdmi from port to television and although I get picture I get no sound
-
Differences between AP Express & AP Extreme
In what situations would someone have one over another or even both? In my situation, I have to imacs (possibly selling one for an macbook), a couple external hard drives for backup and video storage, a printer, a home theater I'd like to stream itun
-
Toolkit.getDefaultToolkit() in Java service never returns on Windows
I'm stumped by this problem. It appears to be specific to a single machine as I can reproduce it reliably there but not on other machines. I'm hoping someone has some thoughts on what could be going on. Here's the scenario: I have Tomcat 5 running as