I'm currently stuck as to why I cannot get 2 connections working.
I have two separate connections in a single c++ program, but when I attempt to commit with the first connection it hangs.
I am running SQL Anywhere 17 Development Server on Linux 64bit.
The code I that hangs is as follows
#include <iostream>
#include <sqlapi.h>int main() {
SAConnection con;
SAConnection con1;
SACommand cmd(&con);
SACommand cmd1(&con1);
try{con.Connect("links=tcpip(host=10.11.12.17;port=49153);databasename=ftnode_sa;servername=ftnode_sa","sadb","sadb",SA_SQLAnywhere_Client);con1.Connect("links=tcpip(host=10.11.12.17;port=49153);databasename=ftnode_sa;servername=ftnode_sa","sadb","sadb",SA_SQLAnywhere_Client);con.setIsolationLevel(SA_ReadCommitted);con1.setIsolationLevel(SA_ReadCommitted);cmd.setCommandText("BEGINTRANSACTION");cmd.Execute();std::cout<<"After first BEGIN"<<std::endl;cmd.setCommandText("insertintotest1(x,y)values(1,'red4')");cmd.Execute();cmd.setCommandText("insertintotest1(x,y)values(2,'Blue4')");cmd.Execute();cmd1.setCommandText("BEGINTRANSACTION");cmd1.Execute();std::cout<<"After 2nd BEGIN"<<std::endl;cmd1.setCommandText("insertintotest1(x,y)values(1,'red4')");cmd1.Execute();std::cout<<"After first INSERT"<<std::endl;cmd1.setCommandText("insertintotest1(x,y)values(2,'Blue4')");cmd1.Execute();std::cout<<"After second INSERT"<<std::endl;cmd1.setCommandText("deletefromtest1wherex=1");cmd1.Execute();std::cout<<"Before first Commit"<<std::endl;con1.Commit();std::cout<<"After first Commit"<<std::endl;cmd.setCommandText("deletefromtest1wherex=1");cmd.Execute();std::cout<<"Before 2nd Commit"<<std::endl;con.Commit();std::cout<<"After 2nd BEGIN"<<std::endl;std::cout<<"Transaction completed sucessfully.\n";}catch(SAException&x){std::cout<<"Error : "<<(constchar*)x.ErrText()<<"\n";}return0;
};
I tried increasing the number of max connections using:
set OPTION PUBLIC.max_connections=20
But it had no effect, still hangs on first commit.
I have however managed to successfully open over a dozen dbisql connections and run sql on each connection.
When I start the server the following appears:
$ ./sastart.sh
SQL Anywhere Network Server Version 17.0.4.2053
Developer edition, not licensed for deployment.Copyright (c) 2016 SAP SE or an SAP affiliate company.
All rights reserved.
Use of this software is governed by the SAP Software Use Rights Agreement.
Refer to http://global.sap.com/corporate-en/our-company/agreements/index.epx.
Connection limit (licensed seats): 3
So it states that there is a connection limit. Does that mean I the server is limited to 3 connections regardless what max connections is set to ?
If so, why am I able to open more than 3 dbisql sessions ?
If the limit is indeed 3 for SQL Anywehere 17 Development Server, and modifying max connections has no effect, does the same apply to SQL Anywhere 16 Evaluation Server, for which a key is needed and an evaluation period of 60 days applies ?