Page 1 of 1

RSLVD :Everything fine with Postgresql but not SQL Server

PostPosted: Mon Aug 05, 2019 11:07 pm
by joe26
Hi again,

Should I send only strings to SQL Server?

RESOLVED. The basic answer is yes.
SQL Server does not recognize the GUID in a comparison, and Query Builder is the tool in use.
Each entry appears to require the use of adding .toString() in the QB '.eq(xxx)' area.


I've found matches to be real particular when using GUIDs.

I've received and error, which appears to be an invalid type requested from SQL Server, but I may be all wet here...

com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to NVARCHAR is unsupported.

I've used Query Builder to be able to move to different databases.

The Queries are laced throughout the code, but follow this structure:

/** @type {QBSelect<db:/stsservoy/users>} */
var fs = databaseManager.createSelect('db:/stsservoy/users');
fs.result.add(fs.columns.user_uuid);
fs.where.add(fs.columns.user_uuid.eq(application.getUUID(userID)));
fs.where.add(fs.columns.tenant_uuid.eq(tenantID));
/** @type {JSFoundSet<db:/stsservoy/users>} */
var FS = databaseManager.getFoundSet(fs); <----------------- This is the line indicated in the Servoy log as the error line, so pretty early on with the first SQL query sent to the server.
var rec = FS.getRecord(1);
/** @type {QBSelect<db:/stsservoy/associations>} */
var as = databaseManager.createSelect('db:/stsservoy/associations');
as.result.add(as.columns.association_uuid);
as.where.add(as.columns.tenant_uuid.eq(tenantID));
as.where.add(as.columns.association_uuid.eq(rec.association_uuid));
/** @type {JSFoundSet<db:/stsservoy/associations>} */
var AS = databaseManager.getFoundSet(as);
var rec2 = AS.getRecord(1);

thanks,
--Joe.

[5486E91F-7994-4E2D-9EB0-7F75EAF05016 ,type: com.servoy.j2db.util.UUID, 5242262B-748A-4D67-90E7-57DE90DB1ED1 ,type: com.servoy.j2db.util.UUID] [1B743225-0F6E-4E30-870C-F0B0FFF2A42F servoySecurityAuthenticator]
com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to NVARCHAR is unsupported.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234)
at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:1094)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:1595)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:1514)
at sun.reflect.GeneratedMethodAccessor148.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.servoy.j2db.datasource.Zg.invoke(Zg.java:12)
at com.sun.proxy.$Proxy2.setObject(Unknown Source)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
at com.servoy.j2db.server.dataprocessing.Zw.Za(Zw.java:765)
at com.servoy.j2db.server.dataprocessing.Zw.Za(Zw.java:681)
at com.servoy.j2db.server.dataprocessing.Zw.Za(Zw.java:1117)
at com.servoy.j2db.server.dataprocessing.Zw.Za(Zw.java:621)
at com.servoy.j2db.server.dataprocessing.Zw.performQuery(Zw.java:208)
at com.servoy.j2db.dataprocessing.FoundSet.performQuery(FoundSet.java:6538)
at com.servoy.j2db.dataprocessing.FoundSet.refreshFromDBInternal(FoundSet.java:435)
at com.servoy.j2db.dataprocessing.FoundSet.browseAll(FoundSet.java:324)
at com.servoy.j2db.dataprocessing.FoundSet.loadAllRecords(FoundSet.java:290)
at com.servoy.j2db.dataprocessing.FoundSetManager.getFoundSet(FoundSetManager.java:2610)
at com.servoy.j2db.dataprocessing.JSDatabaseManager.js_getFoundSet(JSDatabaseManager.java:2618)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:158)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:312)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1774)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:837)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:158)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:406)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3204)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:156)
at com.servoy.j2db.scripting.ScriptEngine.executeFunction(ScriptEngine.java:628)
at com.servoy.j2db.scripting.ScopesScope.executeGlobalFunction(ScopesScope.java:164)
at com.servoy.j2db.FormManager.makeSolutionSettings(FormManager.java:413)
at com.servoy.j2db.server.headlessclient.WebFormManager.makeSolutionSettings(WebFormManager.java:80)
at com.servoy.j2db.FormManager$1.run(FormManager.java:169)
at com.servoy.j2db.server.headlessclient.SessionClient.invokeAndWait(SessionClient.java:1318)
at com.servoy.j2db.server.headlessclient.SessionClient.doInvokeLater(SessionClient.java:1308)
at com.servoy.j2db.ClientState.invokeLater(ClientState.java:1724)
at com.servoy.j2db.FormManager.propertyChange(FormManager.java:165)
at java.beans.PropertyChangeSupport.fire(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at com.servoy.j2db.J2DBGlobals.firePropertyChange(J2DBGlobals.java:92)
at com.servoy.j2db.server.headlessclient.SessionClient.solutionLoaded(SessionClient.java:598)
at com.servoy.j2db.ClientState.loadSolutionsAndModules(ClientState.java:1478)
at com.servoy.j2db.server.headlessclient.SessionClient.loadSolution(SessionClient.java:328)
at com.servoy.j2db.server.headlessclient.SessionClient.loadSolution(SessionClient.java:287)
at com.servoy.j2db.server.main.Zp.run(Zp.java:3)
at com.servoy.j2db.server.main.Zl.login(Zl.java:80)
at com.servoy.j2db.server.main.Zn.login(Zn.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)