UCI connections to non universe databases is not allowed - vbscript

I need to access unidata database from a server. I tried using vbscript.
Set conn = CreateObject("ADODB.Connection")
conn.Open"Provider=IBM.UniOLEDB.1;Data Source=myunidatadatasourcename;User ID=myuserid;Password=mypassword;Location=D:\info\mydatabase;"
uci.config file contains
<myunidatadatasourcename>
DBMSTYPE = UNIDATA
network = TCP/IP
service = udserver
host = xxx.xxx.xxx.xx
But I got an error
Can anyone help?

http://www.pickwiki.com/index.php/JavaSource has some good Uniobjects troubleshooting tips, though it's obviously java-centric. A couple of things to check and try are:
Make sure you can telnet to 31438 on the Unidata server. If not,
it's either not listening (run startunirpcd) or you have a firewall problem.
Try creating an ODBC connection and click the test button. The error messages are more informative.
If you have an ODBC connection, try removing the provider info. It's probably
not IBM any more, unless you have a really old client.
conn.Open"Data Source=ODBC Alias;User ID=myuserid;Password=mypassword"
Check out connectionstrings.com - it's super helpful for this kind of ODBC/OLEDB nonsense.
There's some setup involved on the Unidata side to allow SQL statements. If you want to try a quick test, point the ODBC to $UDTHOME/demo and try "SELECT CITY FROM CUSTOMER" which should run without errors.

Related

SQL Server 2016 linked Oracle Server - Suddenly stopped working

After rebooting my Windows Server 2016 Standard (SQL Server 2016) my SSIS process that runs this query:
select * from openquery(HRMPROD, 'SELECT QUERY HERE' )
started failing with this error:
I get the same error if I try to run the query in SSMS. I have the same linked server set up on my test instance and the query is successful when I run it there. I have compared the linked server create script on both instances and it is the same.
Any idea where I should look for what is causing the connection issue on the one server but not the other?
Thank you.
Saying the answer is on the Oracle side is just like pointing fingers across the way. Let's just fix the issue here.
There is a connection string that is used from SSIS, (which you also used in SSMS) The connection string contains three main components to connect and would result in the 12154 error if any of them were incorrect:
Host
Instance name (different than Instance on Sql Server, think database name)
port
The port most likely hasn't change, neither has the database name, but the host...No, hasn't changed, but the DNS server used to connect most likely has! I would ping the host and see what returns from the SSIS and your SSMS host that you're using. I would expect it to fail. Find out what IP address the host is using and ping that - see if it returns. I'm guessing that's the change that needs to be updated or your Network folks need to fix a DNS configuration/server issue.
Hope this helps!
Kellyn
Since you are getting a response from the TNS Listener, the problem lies on the Oracle side. See Architecture of Oracle Network Services for an overview of how the Oracle networking handles things. Keep in mind that based on the error message you've reached the TNS Listener, so you only need to check things between TNS and the Oracle database... In other words, your networking and SQL Server settings are fine or you wouldn't be able to get this error message.
I would agree with above that the issue might have to do with the network. I have come across that a few times, where we can set everything up, but a firewall is blocking communication between the two servers.
Open up powershell on the new server and run a tracert to the target to see the hops and identify if is connecting across the network.
If it is, then run a test-netconnect on the specific port, to see if the port is open from the firewalls.
Cheers!

Cannot connect to Oracle database via TCPS

We have an Oracle server set up and are using TCP with SSL as connection. This setup was made with the assistant wizard and we used the default settings pretty much everywhere (which also means that no tnsnames.ora or listener.ora exist). lsnrctl status shows that the correct ports are listening.
We are trying to connect to this database via DBeaver and SQuirrel SQL but cannot get it to work. We have set the vmargs for the programs to contain the certificate of the server (e.g. dbeaver.exe -vmargs -Djavax.net.ssl.trustStore=C:/...keystore.jks -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.trustStoreType=JKS), which works fine.
Connecting to the database with a concrete JDBC URL string (jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=IP)(PORT=5500))(CONNECT_DATA=(SERVICE_NAME=testdb)))) does not work and times out after 60 seconds without a proper error (IO Error: Got minus one from a read call). We have tried pretty much everything and cannot get it to work.
The ports are correctly assigned, the database can successfully get accessed with the normal TCP protocol and port 1521.jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=IP)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=testdb)))
Are we missing steps? There don't seem to be any firewall issues. The certificates seem to be working fine as well, but we cannot connect with any of the programs (or sqlplus via command line).
Anyone know what could be the problem? Thanks!
Can you check out the SSL blog or our OTN page for step-by-step instructions? If you are using TLSv1.2 then the JDK version and JDBC driver versions are very important.
In the end I got it to work. There are various sites online that show you how it's done. I used this one:
https://database.edorex.ch/blog/database-connection-with-a-certificate/
Getting the wallets set up, certificates set up and the user set up in the database were the most important steps. Additionally, I had to separate the server and client machines. The server is now on a VM and it works that way, I couldn't get it to work having both on the same machine.

ORA-12541 TNS :no listener on 1 specific remote database, but not on others

Some context: I'm setting up an environment to run some Ruby code our Lead wrote to connect to some remote Databases. I'm using Win10 and have WSL installed. I have installed SQL*Plus, docker, and Ruby, and am sure I have installed all the dependent gems (actually at this point I know for a fact its not a ruby problem). I'm using Docker to use a pre-built image of an Oracle Database, and I have populated it with data.
Obfuscated company DB information:
'Broken' DB (TNS no listener)
Username: W-WORK-DEV
Password: password
Host: host1
Port: 999
SID: W-WORK-DB.tech.company
'Working' DB (can connect just fine)
Username: C-OLD-DEV
Password: password
Host: host2
Port: 999
SID: C-OLD-DB.tech.company
Please note the names I have provided here are purely for obfuscation, they do not represent anything about age or even config. They are essentially the same, just different databases on different hosts. Also note this is a corporate company and would have a lot of base infrastructure for their internal network.
The issue I am having is that with the specific database I am working on, I cannot connect to it. I connect to the company intranet via a VPN (I work offsite) and have issues connecting to WORK-DB.tech.company, though I can connect to C-OLD-DB.tech.company. Methods I have tried to connect with:
Oracle SQL Developer
I have inputted all the correct jdbc strings and username / password. Have even asked other people to attempt to connect (at least 3 others). They can all access C-OLD-DB as well as W-WORK-DB. When using this method, I get The network adapter could not establish the connection.
Side note: I'm fairly sure I have connected to the DB just fine in the past, though I can't be certain because I'm fairly new to this team and have only accessed it once, if that.
SQL*Plus via WSL
I installed SQL*Plus because I think Ruby was accessing it in some capacity when running the script. I got to the point where the script was able to connect to my local docker Database, but when it tried to connect to the remote database, it would return TNS: no listener. I attempted this using sqlplus as well and got the same error.
Example:
sqlplus C-OLD-DEV/password#host2:999/C-OLD-DB.tech.company
This command works and connected to the DB jsut fine.
sqlplus W-WORK-DEV/password#host1:999/W-WORK-DB.tech.company
This command gave me TNS: no listener.
During my research I had found mentions about tnsnames.ora, sqlnet.ora, and listener.ora. I have found relevant files around the company intranet and attempted to use them in my own personal environment to no avail (one of the sqlnet.ora files actually stopped me from being able to connect to any) I found mention about a config/database.yml file related to ruby, but our code already has the database information set up and I seem to be getting to the same solution as the script when trying to manually connect via sqlplus.
Here are some relevant environment variables I have set up when doing these installs. I'm thinking that at some point when trying to set up my environment, I messed up some config that changed the way sqldeveloper or sql plus would connect to that database.
$ echo $ORACLE_HOME: /usr/lib/oracle/12.2/client64/
$ echo $TNS_ADMIN: /usr/lib/oracle/12.2/client64/network/admin
$ echo $LD_LIBRARY_PATH: /usr/lib/oracle/12.2/client64/lib
I hope I have provided all the information I have come across and have explained clearly what my issue is, if you have any questions feel free to comment about it so I can clear it up. Thank you for any and all your help.
So my problem ended up being a 'firewall/port' issue. In the end i found out that specific port I was connecting to was blocked, but I thought it was only on my system. Turns out the VPN I'm using was the issue blocking that port. Company has a Primary Data Center and a Secondary one, and apparently the SDC VPN was blocking that port from me. I switched to using the PDC VPN and it worked.
Are you using the 64 bit jdbc drivers?

VS C# sql unable to connect to any sql host

I am knocking together a short program mainly to try and learn some basics. I am finding an issue with this part of code:
{
MySqlConnection connection = new MySqlConnection("server=serverT;User Id=user;password=password;database=healer");
connection.Open();
MySqlDataReader reader = new MySqlCommand("SELECT version FROM version", connection).ExecuteReader();
reader.Read();
etc etc etc
}
Now when i build and run this, It works perfectly, no problems whatsoever, it connects up and i can read without any issue.. (The server is hosted online btw)
When i give out the exe/mysql.data.dll to anyone to run, they are thrown the exception of being unable to connect to any sql host.
I just cant see why I can connect, and they can't. I have tried this now on 3 other remote machines and they all fail to connect, but Mine works OK.
There are no access rules on the hosted sql database, I am allowing access from all IPs
Can anyone shed any light?
You are hard coding the connection string into your code. Your clients have a different server therefore they need a different connection string.
You need to create a form or a config file where the connection parameters are retrieved from.
Please read this:
http://msdn.microsoft.com/en-us/library/ms254494.aspx

Postgres ODBC: connection "actively refused"

I'm using SSH tunneling to connect from a Windows 7 machine to a remote Postgres database.
The tunnel works fine when I use pgAdmin to connect to the remote database. However, I haven't managed to set up an ODBC DSN to connect to the remote database.
I'm creating a System DSN with the same server address/username/password/port/ssl mode as pgAdmin but when I click "Test" I get: "Could not connect to server; No connection could be made because the target machine actively refused it."
Any ideas on where to start debugging? I've ruled out Windows Firewall and remote server configuration, since I can connect with the exact same information in pgAdmin.
Edit
The problem resolved itself after reinstalling Windows.
When debugging this the first thing to do is to start testing the PostgreSQL server with the psql command line utility. This avoids issues of drivers etc to see what is actually going on. Generally speaking my troubleshooting process is:
Can I ping the server?
Can I connect with psql?
When I test my connection via the control panel, does it work?
Now, assuming the problem is on #2, the first thing I would do is try disabling firewalls on both sides (they can be brought up and tuned after trying with both down). This rules out misbehaving firewalls and if it shows this to be a problem then you have the answer on where to troubleshoot.
In my experience Windows firewall can cause all manner of problems. I have even seen it block web pages halfway through the web page. I don't think you can rule out Windows Firewall based on the information you have provided.
If this happens again, the first things to do include disabling both any antivirus software and firewalls.
The other possibility would be a bad ODBC config (maybe port 5423 instead of 5432) or a badly installed DLL of some sort. The latter may be fixed (or not) using sfc /scannow or reinstalling the odbc driver, or other actions.

Resources