I developed an application that accesses the database locally.
Now, how to make this application access the database on another computer in the same network?
This is my connection:
db=QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={SQL SERVER};SERVER=XXXXXXXX-PC\\SQLEXPRESS;DATABASE=XXXXX;uid=sa;pwd=XXXX;Trusted_Connection=Yes");
Related
I have two database one is at client side and one is running at another machine (which i am using a remote database). I have to send a table data from client database to my remote database. But problem is if I use this code:
mysql_query(con, " select * from DB.Table1")
this function only works for Database (client side) and don't connect with my remote database. Its mean only 1 connection is possible at a time. I am doing it in C++ do you have any solution. ?
I'm implementing SymmetricDS (vs 3.9.4), one way replication (server => client), and I have some questions:
server and client are Oracle 12c in 2 different CentOS 7 machines.
On client I need only to install and start symmetric service,
right?
I need to create the SYM tables on client? Since this
replication is only from server to client I think it is not
necessary. right?
how client communicate with server? just based on
the sync.url property on engine file?
thanks
on client you'll need to install the symmetricDs service
you can create the sym_* tables or leave symmetricDs to create them. sym_* tables are necessary for symmetricDs to function
yes, the client will use the sync.url to connect to the server, register and request the initial load. Then the server will either push new syncing data to the client or the client will pull the new data from server. It depends how this communication is configured
I am new to database programming.
I am trying to make an application that interacts with a database file locally so that I can use those database query.
I tried to use mySQL connection c++ 1.1.6, and run this example.
Following error is what I get:
MySQL server on '127.0.0.1' <10061> <MySQL error code: 2003, SQLState:>
I guess that I need to have a server on for connecting. What I want is just an interaction with a database file locally, do I need to make this connection also? If I really need this connection, how to make it works?
I writing a c++ program that should connect to a mysql database.
it works successfully when I use the local database, but I get an error
"Can't connect to mysql database on '192.168.0.111' (111)"
when I try to connect to a database on another computer.
this is the function that test my connection:
void addb()
{
string mainServer="192.168.0.111";
string mainDbUser="root";
string mainDbPass="111";
MYSQL *connect; //database connection variable
connect=mysql_init(NULL);
if(!connect)
cout<<"Couldn't initiate connector\n";
if (mysql_real_connect(connect, mainServer.c_str(), mainDbUser.c_str(), mainDbPass.c_str(), "main" ,0,NULL,0))
{
cout<<" done\n";
}
else
{
cout<<mysql_error(connect)<<endl;
}
mysql_close (connect);
}
both computers are running Linux Mint OS.
I tried disabling my firewall on the second computer but i got the same problem.
note: I can access the database using phpmyadmin with my web browser.
Make sure the firewall allows MySQL port on the DB machine.
Make sure in the my.cnf the database is loaded with you have the proper network configuration (to listen to the public IP).
From the error message - I would suspect it is a firewall issue - so make sure the DB machine firewall allows incoming communication (and specifically - that SELinux enables it in addition to the firewall) and that the sending machine allows outgoing communication to this machine.
I have client server application that works with Firebird server. Everytime when clients connect to the server they(client apps) don't check if there is a network connection to the server so at this time my application sometimes freezes when the server computer is switched off or service has stopped, so first of all I need to check connection if remote host is switched on or at some port anything listening....
Before establishing the connection I need to check it and make sure server and service is running using Indy components.
Any ideas? also I can use IcmpClient to ping remote host and then establish connection but which is the most optimal way ?
If you just want to check if the server computer can be reached, you could do a "ping" to check that. However, if you want to check if a specific TCP port is open, then the only way to find that out is to actually do a proper connect, which leads to the "freezing" program while the connection times out if there is no-one listening on that port.