Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Cyril
Posts: 8 Joined: Wed Sep 13, 2023 7:16 am
Location: France
Post
by Cyril » Wed Sep 25, 2024 4:19 pm
Hi
I have a SQL error when I want to initiate a SQLSelect with a SQLConnection on DB2 database
This code perform correctly in VO but not in XSharp with this error:
[IBM][CLI Driver][DB2/AIX64] SQL30090N Opération incorrecte pour l'environnement d'exécution d'application. Code anomalie = "22". SQLSTATE=25000
Code: Select all
FUNCTION Start() AS INT
LOCAL oDbDB2I AS sqlConnection
LOCAL oSqlSelect AS SQLSelect
? "DB2 connection testing"
oDbDB2I := sqlConnection{"DNS_NAME", "USER", "PASSWORD"}
IF !IsNil(oDbDB2I:ErrInfo)
? "Erreur Connection"
? oDbDB2I:ErrInfo:ErrorMessage
ENDIF
oSqlSelect := SqlSelect{"SELECT comm_no, demarch_car_no, f_valid_dat_ca FROM MVSDB2DET.VACMANRX", oDbDB2I}
IF oSqlSelect:Execute()
? "requete OK"
ELSE
? oSqlSelect:ErrInfo:ErrorMessage
? "requete KO"
ENDIF
oSqlSelect:Close()
oDbDB2I:Disconnect()
Could you help me please ?
Thanks
Cyril
robert
Posts: 4518 Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands
Post
by robert » Thu Sep 26, 2024 5:45 am
Cyril,
Which version of VO were you using?
There were changes in the SQL classses between VO 2.7 and VO 2.8.
Our classes are compatible with VO 2.8.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Cyril
Posts: 8 Joined: Wed Sep 13, 2023 7:16 am
Location: France
Post
by Cyril » Thu Sep 26, 2024 7:21 am
Hi
We use 2.7 VO version
Is there a solution to fix our issue ?
Thank you
Cyril
robert
Posts: 4518 Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands
Post
by robert » Thu Sep 26, 2024 9:40 am
Cyril,
Try this
Code: Select all
oDbDB2I := sqlConnection{"DNS_NAME", "USER", "PASSWORD"}
IF !IsNil(oDbDB2I:ErrInfo)
? "Erreur Connection"
? oDbDB2I:ErrInfo:ErrorMessage
ENDIF
// The Cursor options are SQL_CUR_USE_IF_NEEDED, SQL_CUR_USE_ODBC, SQL_CUR_USE_DRIVER
// VO 2.7 used SQL_CUR_USE_ODBC. VO 2.8 and X# use SQL_CUR_USE_IF_NEEDED
oDbDB2I:OdbcCursors := SQL_CUR_USE_ODBC
oSqlSelect := SqlSelect{"SELECT comm_no, demarch_car_no, f_valid_dat_ca FROM MVSDB2DET.VACMANRX", oDbDB2I}
IF oSqlSelect:Execute()
? "requete OK"
ELSE
? oSqlSelect:ErrInfo:ErrorMessage
? "requete KO"
ENDIF
oSqlSelect:Close()
oDbDB2I:Disconnect()
XSharp Development Team
The Netherlands
robert@xsharp.eu
Cyril
Posts: 8 Joined: Wed Sep 13, 2023 7:16 am
Location: France
Post
by Cyril » Thu Sep 26, 2024 3:42 pm
Realy realy thanks !!
it's ok with this option
just a little correction for futur readers, we can't change option after open connection so we have to do this
Code: Select all
oDbDB2I := sqlConnection{}
// The Cursor options are SQL_CUR_USE_IF_NEEDED, SQL_CUR_USE_ODBC, SQL_CUR_USE_DRIVER
// VO 2.7 used SQL_CUR_USE_ODBC. VO 2.8 and X# use SQL_CUR_USE_IF_NEEDED
oDbDB2I:OdbcCursors := SQL_CUR_USE_ODBC
oDbDB2I:oDbDB2I:connect("DNS_NAME", "USER", "PASSWORD")
IF !IsNil(oDbDB2I:ErrInfo)
? "Erreur Connection"
? oDbDB2I:ErrInfo:ErrorMessage
ENDIF