Karen Schaefer
asked on
code to validate Oracle Client tool is loading on pc
I am looking for a way to validate if the user has any version of Oracle client Tool loaded on their local PC on open of the Main Menu or the Startup screen. There maybe multiple versions to consider. My problem is that the file path contains the version of Oracle. how do I work around this?
Any suggestions is greatly appreciated.
Thanks,
K
Any suggestions is greatly appreciated.
Thanks,
K
ASKER
not sure how to approach that.
K
K
Approach what? The instant client verification or the registry?
Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle
That folder is static across all versions. At least for now.
Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle
That folder is static across all versions. At least for now.
You can check the registry but that isn't 100% accurate.
The Instant Client doesn't write to the registry.
The Instant Client doesn't write to the registry.
Approach what? The instant client verification or the registry?
Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle
That folder is static across all versions. At least for now.
Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle
That folder is static across all versions. At least for now.
Approach what? The instant client verification or the registry?
Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle
That folder is static across all versions. At least for now.
Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle
That folder is static across all versions. At least for now.
ASKER
okay you keep sending the same response multiple times.
Sorry. On mobile and it is messing up.
ASKER
"Also, except for the instant client, regular Oracle installs keep an inventory file in c:\program files\oracle"
Do you mean to do a chkDir for a particular file?
Do you mean to do a chkDir for a particular file?
Not exactly sure what you are needing. The subject of the question mentioned 'code'. I assumed you were writing some program and needed to verify the install of some part of the Oracle client.
The Oracle client has many pieces that may or may not be installed.
What are you needing?
The Oracle client has many pieces that may or may not be installed.
What are you needing?
ASKER
I need to look on each users pc to verify if they have a version of Oracle Client Tool. to run a connection string to an Oracle database. To prevent an error message - Provider not found....
K
K
Then you need to verify specific drivers in the client are installed. For example, ODBC.
Are you wanting to do this automated or manually?
Automated you will need to write code or a script to look in the inventory file.
Manually, just run the Oracle Installer and look for what is installed.
Are you wanting to do this automated or manually?
Automated you will need to write code or a script to look in the inventory file.
Manually, just run the Oracle Installer and look for what is installed.
ASKER
strange that you say that I just found the following code and attempting to test it now.
Option Explicit
Public OracleConn As ADODB.Connection
Public User_Id_Conn As ADODB.Connection
Public strUID As String
Public strPWD As String
Public Const PRD_ORACLE_ENV As String = "Name of Instance"
Sub Main(Batch_Interactive As String, Oracle As Boolean)
Dim isInProduction As Boolean
Dim SQL As String
Dim SQL_RS As ADODB.Recordset
On Error GoTo ErrStartConnection
Set OracleConn = CreateObject("ADODB.Connection")
'Build the correct connection string for Oracle
OracleConn.ConnectionString = "DRIVER={Oracle ODBC Driver};UID=user name;PWD=password;" _
& "DBQ=" & PRD_ORACLE_ENV & ";Server = server name ;"
OracleConn.Open
Exit Sub
ErrStartConnection:
'put your checking here
End Sub
I suppose if you try to use the driver and it works, then it is installed.
That is one way.
That is one way.
However what if the Oracle client is installed but the ODBC driver isn't?
ASKER
the ODBC driver is not need - I will be using DSN-Less connection string.
I unsure what the call string should have.
Sub Main(Batch_Interactive As String, Oracle As Boolean)
I want to call this function on load of the Startup screeen. Batch_Interactive As String what should this be.?
K
I unsure what the call string should have.
Sub Main(Batch_Interactive As String, Oracle As Boolean)
I want to call this function on load of the Startup screeen. Batch_Interactive As String what should this be.?
K
Doesn't the dsnless connection still need the odbc drivers?
ASKER
no is is set within the connection string - this way I do no have to load an ODBC Driver on everyones PC.
k
k
Then what are you wanting to check is installed?
I'm starting to get a little confused.
I'm starting to get a little confused.
ASKER
Here is my latest attempt, however, not sure how to activate the code - Unsure what to pass as the string value and/or the boolean value.
Function Main(Batch_Interactive As String, Oracle As Boolean)
Dim isInProduction As Boolean
Dim SQL As String
Dim SQL_RS As ADODB.Recordset
On Error GoTo ErrStartConnection
Set OracleConn = CreateObject("ADODB.Connection")
'Build the correct connection string for Oracle
OracleConn.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(COMMUNITY= tcp.world)" & _
"(PROTOCOL=TCP)(Host=ussedb16.ca.*****.com)(Port=1521)))(CONNECT_DATA=(SERVICE_NAME=db1.bdatadb)));" & _
"User Id=********;Password=********;"
OracleConn.Open
Exit Function
ErrStartConnection:
Call _
MsgBox("The Oracle Client Tool is not currently Installed. Please download the latest Version of Oracle Client Tool from software Express.", _
vbCritical, "Oracle Client Tool")
End Function
Public Function OpenNewSR()
Not sure you need those parameters.
You also switched drivers from odbc to oledb.
Like I mentioned above, that code will only tell you if the oledb drivers are installed. The client might be installed and missing that specific data provider.
You also switched drivers from odbc to oledb.
Like I mentioned above, that code will only tell you if the oledb drivers are installed. The client might be installed and missing that specific data provider.
ASKER
ok I just found another bit of code I am going to text.
found on EE:
https://www.experts-exchange.com/questions/22856864/Deterimine-if-Oracle-Client-is-installed-using-Visual-Basic-VB.html?sfQueryTermInfo=1+10+30+spliterrtext
thanks for your input.
K
found on EE:
https://www.experts-exchange.com/questions/22856864/Deterimine-if-Oracle-Client-is-installed-using-Visual-Basic-VB.html?sfQueryTermInfo=1+10+30+spliterrtext
thanks for your input.
K
That looks like it searches the registry for the keys like I mentioned before.
You still haven't mentioned what specific piece of the client you are looking for.
I mentioned before, the client has many pieces and not all of them are installed. You need to know what part you need.
You still haven't mentioned what specific piece of the client you are looking for.
I mentioned before, the client has many pieces and not all of them are installed. You need to know what part you need.
ASKER
I am not sure what piece I am looking - I just need to validate that Oracle Client Tool in some form does exists on the current user's PC. I think this code does the trick. I need to do further testing on a machine that does not have the tool on it.
Again thanks for your time and efforts.
Karen
Again thanks for your time and efforts.
Karen
You stated above: To prevent an error message - Provider not found....
To prevent this error you need a specific data provider. Just checking that the client is installed will not be enough.
The data providers are optional on the install.
To prevent this error you need a specific data provider. Just checking that the client is installed will not be enough.
The data providers are optional on the install.
ASKER
any ideas on how to specify the Provider?
k
k
you either need to know where in the registry Oracle places that information for each release or look inside the inventory file.
Or as you have been posting code examples: try to use the driver you need. the issue there is what I have mentioned: the client might be installed and just missing the provider.
It boils down to exactly what you need to do in those situations.
Or as you have been posting code examples: try to use the driver you need. the issue there is what I have mentioned: the client might be installed and just missing the provider.
It boils down to exactly what you need to do in those situations.
ASKER
Ok after checking one of our Oracle Guru- he suggested that we look for the Software\Oracle\OracleHome or some wildcard version of that within the RegEdi file.
Got any ideas on how to modify the code to look for that Oracle*Home* file?
Karen
Got any ideas on how to modify the code to look for that Oracle*Home* file?
Karen
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the input, however, I abandoned this approach to complex for my needs. My time will not allow me to pursue this at this time.
Thanks again for all your input.
Please award points for his time.
K
Thanks again for all your input.
Please award points for his time.
K
The Instant Client doesn't write to the registry.