Laravel 5.5 close Postgresql database connection - database

I searched on web but not found a solution to my problem.
My environment:
Laravel 5.5
PHP 7.2
Postgresql 12.3
Ubuntu 18.4
My problem is that DB::disconnect() doesn't close the connection.
My project have multiple database connection to Postgre and many jobs that use this connection.
Inside the job I want to disconnect from the default connection and connect to a specific one.
So if I run multiple times the job, it will create multiple connection and never close the old one.
I tried with DB::reconnect(), DB::disconnect() and DB::purge(), but the connection still open.
I read that the PDO connection is close when all references are set to null, it is possible that the framework keep some reference to the PDO connection and so it will never close?
I tried to make a simple script like:
DB::connect('some_connection');
DB::disconnect('some_connection');
But I can see the connection open on my database.
Any solutions?

Related

how to solve netezza SQL Error [1100] [HY000]: ERROR: System is not 'Online'

I download netezza emulator and run it on VMware workstation. Then connect via Dbeaver. When I run
SELECT * FROM TEST1;
I am getting SQL Error [1100] [HY000]: ERROR: System is not 'Online'
how can I solve this error.
Also I cant create new table on emulator when I try to create new table. It doesnt give any error but it also never respons. Dbeaver says execute query and count seconds but no response
Hard to tell, the error message only says that your client (dbeaver) cannot contact the server (Netezza). A couple of guesses:
you forgot to turn your emulator on (you mentioned an emulator???)
you connect to the server using the wrong IP address and/or port number
a firewall is blocking your access (either on you client side, on the server. or between if it’s not an emulator your are using)
Perhaps Try Ping’ing the server from the client and vise versa (a command prompt of some sort). Then get back to us
When you add Netezza emulator to vmware virtualize intel vt-x option is not enabled so it prevents to netezza run properly. You need to enable Virtualize Intel VT-x/EPT or AMD...
Option then reboot netezza vm then netezza will start normally.
if you want to control whether netezza working properly or not you can use
nzstate
command

SSIS to Oracle "Could not create a managed connection manager."

I'm trying to use SSIS to load some data from Oracle database to MSSQL database.
I created the project and used the ADO.Net source and was able to create a connection to Oracle and run queries and view results.
However when I actually run the package I get the following error:
Error: 0xC0208449 at Data Flow Task, ADO NET Source 2: ADO NET Source has failed to acquire the connection {EECB236A-59EA-475E-AE82-52871D15952D} with the following error message: "Could not create a managed connection manager.".
It seems similar to the issue here
And I did find that I have two oracle clients version installed "11.1" and "12.2".
One is used by PL/SQL and the other by other entity framework project.
If this is the issue I just wanted a way to tell the SSIS to pick-up the correct one.
I tried adding Entry in machine.config for "oracle.manageddataaccess.client" section with the desired version.
I also tried using other types of data sources but couldn't even create a successful connection
I tried changing the Run64bitRuntime property in the project to False
Note: I don't have SSIS installed on my machine.
Eventually, I just had to remove the entries related to 11.1 in path variable then restarted my machine.
Also I switched to "dotConnectForOracle" for connection and now it seems to be working fine.
I'm expecting issues related to other applications that might still be using the 11.1 version, but that will be a problem for another day.
Always make sure to write the user (oracle schema) in uppercase and some special characters [in my case it was $] in the password needs escape character even if you're using the wizard not the cmd
I still don't understand the whole issue but I hope this helps someone some day.

OCIServerAttach() hangs forever

I have observed quite some time that the connection attempt to an Oracle server using OCI library hangs forever and I am not able to find a way out to cancel the hung session. Even Ctrl+C doesn't work.
Do we have an option to call OCIServerAttach API in non-blocking mode or is there is an option that can be used to timeout the OCIServerAttach call?
Please note that the OCI version I am using is 11.2.0
Oracle Net can be configured to limit the connection establishment time. The available options have been enhanced in various versions. Oracle 11.2 is 10 years old!!
For recent versions (check the manual for your version), you could create a sqlnet.ora file with options like SQLNET.OUTBOUND_CONNECT_TIMEOUT or TCP.CONNECT_TIMEOUT, or use CONNECT_TIMEOUT in a tnsnames.ora file. Search for 'connect_timeout' in that manual for other choices.
If you use 19c client libraries (that, by the way, will connect to Oracle DB 11.2 or later) then you can even use a timeout option in an Easy Connect connection string like "mydbmachine.example.com/orclpdb1?connect_timeout=15"

Labview - SSMS database communication... How to communicate between Labview and Microsoft SQL Server on separate devices?

I am attempting to set up a communication between Labview and Microsoft SQL Server, on two separate devices, in order to send and receive information about the database from both labview to SQL Server and SQL Server to labview. However, when I reach the "Data Link Properties" menu, I get the same "unable to log in" error upon attempting to log into the server. The server name comes up, however, an error occurs once I move on to select the database on that server. Is there any solution or tutorial to this problem that can allow me to successfully communicate back and forth from labview and smss on separate devices?
I've opened up various ports to allow a connection, even disabled the firewalls on both devices. The devices are connected via an Ethernet cable and I AM able to ping the devices to each other. However, in regards to being unable to log into the server in ssms, I have created new users, adjusted the login properties, tried changing permissions, but anything I try doesn't seem to solve my issue.
Can't really help much without seeing the error or some of the code of what you are trying to do.
That being said, if you go to the menu and select Help>Find Examples... and search for database, you should see a bunch of different things related to database connections. You may find the Database Connection.vi one helpful.
More info on the Database Connectivity Toolkit in LabVIEW can be found here
I see there can be one of the 2 issues
1) Inbound/Outbound port rules not set, Remote connection to server is not allowed.
2) If the server has multiple instances then you need to provide full host name of the instance you are trying to connect.
*Please refer to the below link to configure firewall rules.
https://learn.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-2017

Connecting to sql database

(I am a sql noob and I just can not figure this out on my own)
For some time now I have been trying to establish a connection to a SQL database in codename one but to no avail. First I tried connecting to a MariaDB database from one.com. All that's needed for the connection is
Database db = Display.getInstance().openOrCreate("databaseName");
if I am not mistaken, but I am guessing this implies that I have somehow already established a connection to the database. This is not the case however so it creates a new .sql file, right? I can recall that you can connect to a database in the services tab in Netbeans. I chose the MySQL(Connector/ J Driver) which should work with MariaDB, or should it? I entered all my data and i says that it can not establish connection to the database.
the error i get
So I thought I might as well try using localhost. I used XAMPP to host a database and connected in the netbeans services tab.
connected?
Now testing was needed to see if this works. I started the SQL journey with this https://www.codenameone.com/manual/files-storage-networking.html#_sql and integrated the part after "You can probably integrate this code into your app as a debugging tool". I changed database name to "mybase" (it's existance can be confirmed in picture 2). Ran the app, opened the dialog, entered "select ID from customers" and got: java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: customers) It does not get past the first call to "executeQuery". The customers table definitely exists so what am I missing to establish connection?
I really need instructions to connect to the localhost database and ideally also to the one hosted by my webhost provider.
Thanks,
Jona
The Database class is to access the SQLite DB on the mobile device. To connect to external databases, you'd have to do something different, such as a ConnectionRequest or Socket I think.

Resources