We could just check if the remote port (usually 1521) is open but unfortunately Oracle opens this port during bootup process, so we cannot rely on it.
Any other ideas? Thanks!
(some background info: I am checking a remote oracle host from bash script)
update: seems like it is only possible with oracle client software
Okay, because we agreed not to include client side stuff from Oracle to the context where we are doing this check, I implemented a minimal Java application that returns 0 if the Oracle DB is up and running and returns 1 otherwise.
This app can be repeatedly called from a script until it returns 0.
Under the hood, we are connecting to the Oracle DB with the JDBC driver and check V_$INSTANCE / STATUS table.
Related
I've successfully installed the Pervasive 13's 64bit Client onto Ubuntu Server 18.04.
How can I now establish a connection to the Pervasive 13 server (which is installed on a Windows 2008 R2 server) and perform a sql query?
I'm extremely confused by the documentation, which directs me to the bcfg tool after client installation. I'm not clear if that tool is for configuring the server or for setting up the client connection. Ether way, the documentation is too abstract for my comprehension; I need concrete examples of someone successfully establishing a connection to (at least a hypothetical Pervasive server located at some hypothetical ip address) and NOT JUST abstract syntax that never shows an example of SQL statement being submitted from command line Linux.
Seriously, the documentation covers so much detail of stuff I don't immediately care about, that I can never seem to figure out my practical needs which are to simply establish a connection to the database, perform a SQL query, and get a result set.
The installation of the client should have sensible defaults, and the documentation, after installation, should focus on getting you connected and running sql statements as quickly as possible, instead of going on and on about details that are only of interest if the defaults aren't sensible. Let me connect first! Then if I have a problem, only then do I care to learn further detail about other aspects of configuring the connection.
Pervasive is such an obscure database server, that I'm left with only this documentation to figure this out. Any other database would probably have YouTube videos that show you how to install the client, and start making some SQL queries and getting result sets.
Someone at Actian, ought to be kind enough to make a quick start video for the client on Ubuntu Server that quickly covers installation and finishes where you're submitting sql queries and get result sets. After all, that's the purpose of database client.
Can someone please provide some concrete examples of how I can turn this successful installation into a relationship with the database server where I can submit SQL queries and receive result sets?
I'm not sure why the documentation points to bcfg.
If the Client is installed and didn't display any errors, you need to add an ODBC DSN using dsnadd (https://docs.actian.com/psql/PSQLv13/index.html#page/uguide%2Fuguide.dsnadd.htm%23ww68699). An example of creating a client side DSN pointing to a remote database is:
dsnadd -dsn=clientDemodata -db=Demodata -host=WindowsServerName
(where clientDemodata is the DSN created on the Linux box, Demodata is the PSQL database on the remote server called WindowsServerName).
Once the DSN has been added, you should be able to use isql or isql64 (https://docs.actian.com/psql/PSQLv13/index.html#page/uguide%2Fuguide.isql.htm%23ww138933) to execute a query.
Running isql / isql64 with just the DSN will let you execute SQL queries interactively:
isql64 clientDemodata
An example of running isql using a file as input for the SQL statement(s) is:
cat two-queries.sql | isql clientDemodata -b
If you've done all that, what errors or behavior are you seeing?
I have PostgreSQL database engine running on MS-Windows 7 Cz. A client program, which communicates with this pgsql database, runs the MS-Windows 7 Cz, too. The program is installed with US-English language mutation.
In this default configuration everything goes well. But I want to pair the Windows client program with the PostgreSQL database running on Linux.
The first try failed, but on both sides no reasonable information was logged.
I made some comparisons of the Linux db. crated fractions vs. the MS-Windows db. I only found the difference in the COLLATION settings. On Linux db. the default is "cs_CZ.UTF-8", but on the MS-W db. there is "Czech_Czech Republic.1250".
I do really not know what the COLLATION is for, because on the both OS in the dbs. the default internal encoding is utf-8. Does it means the that the MS-W client speaks to db. using cp1250, while the Linux db. expects the utf8? (Every explanation of COLLATIN speaks about the locale alphabet order?)
It is impossible to change the client behavior, but due to the stability and other database parameters it is highly important to migrate to the Linux server platform.
Can somebody give me some helpful guidelines, how to prepare the Linux PostgreSQL database in ought to be accepted by the MS-Windows client program? The program support team did not (cannot or may be must not) helped me over two month discussion.
Thanks in advance
Yes, finally it was very easy: the critical difference between the MS-Windows configuration and the Linux one, it was the Authentication conf module: pg_hba.conf! Its content is by default in Linux more tolerant to developer working on locahost connection:
host all all 127.0.0.1/32 trust
but in MS-Windows the connection rules are very strict:
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
The client program has no configuration file that may change its behavior.
Lots of polling with Wire-Shark was made to note such simple difference.
I'm trying to set up my embedded Linux machine as a MySQL client, in order to connect to a external MySQL server (running on a remote machine). sqlite is not an option.
I understand, thanks to Basile Starynkevitch that I have to use libmysqlclient (because that is the only library to run such a connection and dealing with the MySQL client/server protocol on the client side).
Qt stats that:
You need the MySQL header files and as well as the shared library
libmysqlclient.so. Depending on your Linux distribution you may need
to install a package which is usually called "mysql-devel".
Did someone did this and can point out to the right package?
Yes, assuming what you want to do is use the QtSql API to access a MySQL database without connecting to an external MySQL server. With the embedded server library, the server runs in the same process as your client Qt Application, similar to how SQLite works.
One caveat though: the libmysqld embedded server library is deprecated as of MySQL 5.7.17 and will be removed in MySQL 8.0. (as mentionned on http://dev.mysql.com/doc/refman/5.7/en/libmysqld.html)
Your question is confusing and seems contradictory.
Either you want to work with an external MySQL server, and that means that your application opens a (tcp(7) socket) connection to some remote machine running mysqld. Then you have to use libmysqlclient (because that is the only library to run such a connection and dealing with the MySQL client/server protocol on the client side).
If that mysqld server is running as a different process on the same embedded Linux system you should have some way to start it (probably as part of the init scripts on it). Then you still use a socket communication to it, and you still need libmysqlclient. A possible difference with a remote machine running mysqld might be (but I am not sure) the socket family. Perhaps libmysqlclient is using unix(7) sockets in the special case of connecting to a server on the same machine.
Or you don't want any external server. You might consider libmysqld but as Romain answered it is deprecated and is becoming unsupported (so I feel that would be a very bad choice). Then all the database code is running on your embedded Linux computer, which also has all the data storage. In that case (relational database & data & storage on the same embedded Linux computer), I would recommend using sqlite instead because it is well supported and quite stable.
If your mysqld daemon is running on a remote machine you cannot (realistically) avoid libmysqlclient (otherwise you'll need to rewrite most of it).
I ended up doing the following:
Installing MySQL on my embedded Linux and tested it with
mysql --host=1.2.3.4 --user=Foo --password=FooPass testdb
When an MySQL server is runing on 1.2.3.4.
I recompiled Qt with the -sql-mysql option, so the new compiled version will include Qt MySQL plugin.
Test if Qt MySQL plugin is supported with the next code:
QStringList driverslist = QSqlDatabase::drivers();
QString str;
foreach (str, driverslist) { qDebug() << str }
Expected output is:
QMYSQL3
QMYSQL
Test that driver loaded as expected with the next code:
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("1.2.3.4");
db.setDatabaseName("TestDB");
db.setUserName("Foo");
db.setPassword("FooPass");
bool ok = db.open();
if(ok)
{
// "Connected"
}
I poll a Windows Server's ODBC database every 10 minutes from a Linux server. Whether or not the Windows program that updates the database is running, I obviously can get data - old data - back from the database.
But I need to be sure that the remote Windows application is actually running and updating the database.
How can I query the remote Windows server to see if the specific program is active?
You should be able to get the information you need via WMI, which linux can query with special packages. the WMI namespace you need will be Win32_process, which will return a collection of process data, from there you can parse the data and work out if your app is running or not. I've linked a linux wmi client below.
https://www.krenger.ch/blog/wmi-commands-from-linux/
Here is the problem: We have a client that uses Progress Openedge database, we need to execute queries on this database from our servers.
Currently the drivers are installed on our Windows server, and the PHP code uses ODBC to run the queries.
Now we would like to move the code to a Linux server. We tried before to work with their linux drivers but that attempt has failed.
The question is, Is it possible somehow to run PHP code on a linux server, this code communicates with the Windows server, runs the query on the Windows server, and return the results to Linux?
How would you access to this problem.
Thanks!
Yes, it's possible. Your question boils down to "how can my Linux server ask my Windows server to do something" (where the "something" happens to be "talk to a database"), and there are a variety of ways to accomplish that. You could run a web service (RESTful or SOAP) on the Windows server, for example.
Make sure you think about security: if you deploy a service on your Windows server that lets remote clients modify a database, you have to be mindful of which remote clients are allowed to use that service. The last thing you want to do is accidentally allow random strangers to run arbitrary queries against your database.
We have a Knowledgebase Article detailing some setup procedures for Linux installations; it also has a video explaining some aspects of the setup. If the other answered haven't provided a complete solution for you, hopefully our article can at least get you started in the right direction.
Also keep in mind that depending on your version of OE, the driver libraries may be different.