How can i read data from Sql Server Axapta Database tables from X++ without ODBC connection?
I don’t want to create the ODBC in all the clients , so I want to access the Sql Server database from X++
without any other dependencies.
You may use Connection class. By default this will establish a connection to the current database session. Code snippet from Developers guide below. Also search in this forum as this subject was already discussed.
server static void main(Args args)
Connection con = new Connection();
Statement stmt = con.createStatement();
sql = strfmt('SELECT VALUE FROM SQLSYSTEMVARIABLES');
// Set code access permission to help protect the use of
perm = new SqlStatementExecutePermission(sql);
r = stmt.executeQuery(sql);
print "An error occured in the query.";
// Code access permission scope ends here.
I am calling stored procedure using connection class nd using executeupdate to execute the stored procedure.In my stored procedure I am calling the view of another database and have full rights on another database. looks like sql connection is timing out and inserting very few records than expected. Same stored procedure with same rights inserts more records when called from sql server.is there any way to increase the query timeout of sql connection