Situation:
I have a program written in VB6
The source code of the program is not available
It connects to a database using ODBC connection string.
The vendor setup a connection name to the database when the program was first installed 6 years ago
My machine crashed, all the settings are gone!
The program vendor is out of business. Even they don't have the source of the program now.
Question:
Can I find the ODBC connection name in anyway?
You can use Process Explorer to catch the connection string your program is trying to open. You can find almost everything a program is doing, and you can filter what information is captured/displayed.
I'm not sure I've understood. What exactly happens when you try to run the program? Is the problem that the ODBC connection string was lost because the settings were lost when your machine crashed?
If so I would try the following.
Look on a backup for the configuration file of the VB6 program. It may be an INI file.
Do you know what the database is? Is it an Access file (*.MDB), SQL Server, or what? You may be able to recreate the connection string from scratch. You might have problems if you need to supply a password.
Are you still in contact with anyone from the vendor? I'd have thought whoever originally wrote the program would be best able to help, and might be willing to do a couple of days consultancy.
Can't you use a decompiler?
You can probably run an ODBC trace and then look in the log file to see what the attempted name was. Run odbcad32.exe and go to the trace tab and turn it on. Run your app and then look in the log file (probably at the SQLConnect call).
Related
I am trying to execute a workflow mapping from within Informatica Workflow. The source being MSSQL Server and target Oracle DB. The mapping alike every other mapping seems to be referring to the system's /etc/odbc.ini file rather than the one sitting in $INFA_HOME/ODBC7.1/odbc.ini.
I've tried checking everything but can't seem to understand how this linking is getting established. I did many hit & trials to confirm which odbc.ini was getting referred and it was always the one sitting under /etc/. The bash_profile's variable ODBCINI is also pointing towards the INFA_HOME location.
Can someone shed some light on how or why the system's odbc.ini is getting referred. Any idea on how is it linked?
We need to set two odbc related parameters in unix/linux users bash profile.
INFA_HOME=/opt/infa
ODBCINI= $INFA_HOME/ODBC7.1/odbc.ini
ODBCINST=$INFA_HOME/ODBC7.1/odbcinst.ini
Now, i feel like, your unix/linux user is not able to reach this location or they arent getting exported properly.
Login using the unix/linux user thats running informatica.
Then use more $ODBCINI to see if it has read permission.
Do same for ODBCINST.
Use ssgodbc tool to check connectivity to your mssql server DB.
It seems the question on how to connect to oracle database from UFT/VBscript is asked on multiple forums. In most places, there are answers in bits and pieces, without any one detailed answer that helps user get this information.
I spent close to 6 days to get this working and thus I feel its worth to share all the detailed steps here. The main reason I found this for going wrong is a wrong combination of one or more of below:
Using the wrong driver.
Using the wrong connection string.
Using the wrong terminal to test the code (i.e. 64 bit to test working for a 32 bit UFT)
When any one of the above is wrong, we get a range of errors depending on which driver, connection string and terminal we are using. I encountered:
Provider cannot be found. It may not be properly installed (when using Microsoft ODBC for Oracle)
The 'OraOLEDB.Oracle.1' provider is not registered on the local machine (when tried using oraOLEDB driver)
Catastrophic failure. (when running a working script on 64-bit terminal)
Hope below answer will give you a step by step answer with references, and code examnples to try out your code and get this up and running for you.
It took me 5 days to get this correctly working and although there is information available on internet, its all scattered and leads to multiple directions, which can be very time consuming and frustrating. So to save you from this frustration and also since test data is very crucial for setting up any meaningful test framework, this section is dedicated to making this properly set up for you. Hopefully, you will not have to face the same frustration that I went through in dealing with this!
To make oracle database connection work in UFT, download a 32-bit driver for your oracle database. To do this:
Go to this page (if your database is 12c - if another database, go to that page), https://www.oracle.com/database/technologies/oracle12c-windows-downloads.html
Scroll down and look for "Oracle Database 12c Release 2 Client (12.2.0.1.0) for Microsoft Windows (32-bit)" - If you are working on oracle 12C
Download the zip file "win32_12201_client.zip"
Extract the file and run "setup.exe" from the folder : Downloads\win32_12201_client\client32
While selecting "What type of installation do you want",
select -> Administrator (1.5GB)
Use windows built in account (3rd option)
Keep default locations for
oracle base -> C:\app\client\yourUserID (no space in between allowed)
software location -> C:\app\client\yourUserID\product\12.2.0\client_2
Save response file for your future reference
Install the product
To test if everything went okay or not, open the ODBC connection for 32 bit
Check in the driver's section, if a driver with name "Oracle in OraClient12Home1_32bit" is installed or not.
Now you can run the vbscript for testing database connection by running it in 32-bit command line mode. (Running it in a terminal on 64 bit machine would give you all sort of errors). To do this on windows,
Type %windir%\SysWoW64\cmd.exe in Start Search box.
Change directory to your script location (say cd c:\Users\yourUserID\UFT\Rusty\FunctionLibrary) - If the script is in dir FunctionLibrary
Now you can run the script by writing cscript in front of it -> cscript database-functions.vbs
You should see values popped up from test script.
Connection string format:
https://www.connectionstrings.com/oracle-in-oraclient11g_home1/ (use standard format from here)
Dim connString: connString = "DRIVER={Oracle in OraClient12Home1_32bit};DBQ=yourHostURL:portNr/DBname;Trusted_Connection=Yes;UID=MyUser;Password=myPassword"
Ex (with dummy values): connString = "DRIVER={Oracle in OraClient12Home1_32bit};DBQ=ab12.mycompany.com:1521/ORAB;Trusted_Connection=Yes;UID=pramod;Password=myPassword"
A script that you can use to test this connection is here.
https://github.com/PramodKumarYadav/Rusty/blob/master/FunctionLibrary/test-data-functions.vbs
Or here: https://hoopercharles.wordpress.com/2009/12/12/simple-vbs-script-to-retrieve-data-from-oracle/
Change the connection string to as mentioned above.
Hope this helps and you can save a lot of time and energy in using oracle connection itself to build tests, than setting this up itself.
I'm learning how to use SSIS to create auto scheduled tasks. Everything went smoothly until the security policy has changed. Before whenever I wanted to connect to database, I just type in IP address, username and password in SSIS connection manager. Now I need to open up OpenVPN first which is still a manual process. So I really would like to put this bit into an SSIS task flow.
I had a search on Stackoverflow and over some other websites. Here is a link in stackoverflow. This example gives the idea that we can use VBA to setup the link. However that example shows we need a VPN connection name and VPN username which I don't really have and don't know where to find. Everytime I just right click on a .ovpn file and choose start openvpn on this config file. Also when I open that .ovpn file there is no command indicating which is my connection name or user name. Here is what it looks like when I open it up (there is no -auth-user-pass thing in this file and I can use this file without having to specify it):
client
dev tun
proto udp
remote a website here 1111
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
verb 3
ca ca.crt
cert office.crt
key office.key
askpass login.txt
Is it possible to find my connection name and user name? If I don't need connection name and user name, can I still write up VBA to build up an auto connection process?
I also notice there is an execute process task in SSIS. Is it possible that I can make use of it (because in my understanding obviously I use openvpn.exe to execute a .ovpn file)?
Please correct me if I'm saying something wrong since I'm new to both VPN and SSIS. And much appreciate for whoever can help me with this.
I don't know anything about OpenVPN, but I ran into a similar problem a while back with a server that insisted on an SSH tunnel using PuTTY as the only allowed connection method.
People who put these policies in place never think of the impact on SSIS, especially for unattended processing.
The solution I found was:
Find the command-line equivalent to the PuTTy client (which is called plink)
Have the detailed documentation to hand, because this is really difficult.
Have the SSIS package start plink.exe, passing various parameters (Note: don't use the Execute Process task, as that waits for the process to exit: launch the process in a Script task, and get the handle of plink.exe's ProcessID).
After a wait, have another Script task in SSIS connect to the plink process' InputBuffer, "typing in" a password. Yes, insecure and clunky, though you can store SSIS project parameters encrypted (this obviously requires SSIS 2012 or later)
The SSIS package can now connect to the server and do data stuff, as if it was a normal server without stupid access requirements.
At the end of the package, kill the plink.exe process.
Bear in mind, also, that on unattended execution (e.g. when scheduled in a job), your package will be running in a different security context from the one you work in to develop the package (depending on the SSIS service settings). If your access to OpenVPN has any dependency on ActiveDirectory, you may have to set up another OpenVPN account for the SSIS service's Logon user.
If this sounds horrible, nightmarishly complicated and unstable, it's because it is. Really, the TL;DR version is: tell whoever administers the server that if they really want you to access it using SSIS, they should put some more sensible access policy in place.
After working with my IT colleague, I think I solve the problem. Here are my answer and opinion to this question, and please correct me if I am wrong.
I think opening a VPN automatically is a case by case issue. In this case I am still using Execute Process Task in SSIS. Inside the task editor, what we are executing is not openVPN.exe, it should be a batch file. In the batch file (.bat file) it contains the command of opening .ovpn file with OpenVPN.exe
The process below gives you more detailed info.
The command line is what I use in the batch file:
#echo off
CD /D "C:\Program Files\OpenVPN\config"
start openvpn client.ovpn
TIMEOUT /T 10
exit
In SSIS execute process task
Hopefully this is useful
I'm not a programmer or anything, I bought a software a couple of years ago and I formatted the computer, but when I called the software company that made the software for me, all their phone numbers aren't working, I think they went out of business or something.
I have the exe and everything, and a SQL Server database .mdf and .ldf, I attach the database to SQL Server through Management Studio, after I install it, but when I open the exe file I get a SQL Server error I will attach a picture of the error in the question, the software was fine before, but I don't know what I'm doing wrong should I do something else beside just attaching the database, forgive me, I'm not very knowledgeable when it comes to programming stuff, can anyone please help me ...
Thank you so much
this is the error message snapshot
This is the content of my config file
and also there is a text file named 1 i don't know if that's relevant or not.
This is the content of that text file
(Data Source=.\SA;AttachDbFilename=C:\Users\Samar\Documents\DB_Center.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True)
In the same folder as the application, look for a .config file (likely to have the same name as the executable).
In this config file should be settings, one of which might be the pointer to a database (called a connection string), which you will want to change to point to your database you just attached.
The error message would indicate that the instance of SQL Server the application is looking for cannot be found...
I am receiving this error message while creating DB from a .mdf and .ldf files located on a network drive.
Query executed:
create database DatabaseName ON
(FileName = '\\gyancluster-sql\g$\Backup\WSS_Content_DB.mdf'),
(FileName = '\\gyancluster-sql\g$\Backup\WSS_Content_DB_log.ldf')
for attach
GO
Error
The file "\gyancluster-sql\g$\Backup\WSS_Content_DB.mdf" is on a
network path that is not supported for database files.
So what is your problem? What is the question? No question there - just dumping a sentence ;)
I mean, without wanting to sound too sarcastic, but you CAN read, or?
The file "\gyancluster-sql\g$\Backup\WSS_Content_DB.mdf" is on a network path that is not supported for database
files.
That is pretty clear, isn't it? It is not supported - for VERY good reasons, btw., until now.
Are you asking us now whether MS lies? No, they do not lie - this is not supported. They REALLY MEAN what they say.
There are ways around (http://support.microsoft.com/kb/304261) but that is it ;)
Do you want us to reword the error message? Maybe into "dude, that wont worx, not cool, see"? Clearer?
Seriously - soudns harsh, but I always wonder why people do not actually READ the error message.
Use DBCC TRACEON(1807) before trying to create the Database.
Also, you can add the linea "-t 1807" to the MSSQL server startup parameters, it will make the change permanent. The command above let you use network storage, but on a reboot you will lose the flag.
You are lucky that the OS is warning you that opening database files directly over a network is a bad idea. Older database api's let you do that with no warning and then network users of that database application are forever blighted with corrupt databases.
If \gyancluster-sql\g$ refers for Local Disk G on the computer gyancluster-sql which also happens to be where the sql service is running, then you really should be using
create database DatabaseName ON
(FileName = 'G:\Backup\WSS_Content_DB.mdf'),
(FileName = 'G:\Backup\WSS_Content_DB_log.ldf')
for attach
GO
Note this remains true even if you are running the script from another computer.
It would still be a bad idea, but you may able to use the UNC names, but only if the service under which sql is running is able to access the share(eg if running under the Domain Administrator account), but that is normally considered an unnecessary security risk.
If you are really trying to store the database on network device, then obviously that means the sql service does need access to the share, so that would be the first thing to check, but you also need to read the Microsoft article which Chris Dickson has pointed you to (ie http://support.microsoft.com/kb/304261) which details when this is supported.
You need to enable the database file over network shared, the following post explain step by step how to do it.
https://blogs.msdn.microsoft.com/varund/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive/
The same post explains the risks to do it.
I hope this helps
Regards