Home » Infrastructure » Windows » Would you please help with connection to Oracle through Power Shell ? (Oracle client 12c)
Would you please help with connection to Oracle through Power Shell ? [message #679124] Fri, 07 February 2020 17:36 Go to next message
dtran
Messages: 5
Registered: January 2020
Junior Member
Hello,
I apologize for asking a basic , trivial question regarding the connection to Oracle database through Power Shell Script.
I am not sure if I have to set up a data source on my Window PC in order to connect to Oracle so I would like to seek your helps.
In my window PC , I already had my Oracle Client 12c stores at %Oracle_HOME% and tnsname.ora stores at %ORACLE_HOME%\admin\bin.

Since I am new to window Power Shell , May I ask if I need to set up a data source name for me to connect to Oracle?

The reason I am asking because I see this line of code in the Power Shell said:



$objConnection.Open("Provider=MSDAORA;Data Source=$($domain)1;User Id = test;Password =test")
Please correct me if I am wrong about MSDAORA. I looked it up on Google which said that MSDAORA is short form for “Microsoft OLE DB Provider for Oracle” and it is in the Oracle Client.
So if it is already in my Oracle Client 12 , and I don't need to download anything . Is it a correct statement?

About Data source, I am not sure if I need to set up data source on my window machine. If I need to set it up, will the following instruction work ?



To configure and locate an ODBC data source:

From the Start menu, click Settings, and then Control Panel.
Select Administrative Tools, and then Data Sources (ODBC).
At the top of the "ODBC Data Source Administrator" window, select the System DSN tab, and then click Add....
From the list, select Oracle in OraClient10g_home1, and then click Finish.



I took it from the university web site (https://kb.iu.edu/d/awqf)


Many Thanks for all of the helps.

[Updated on: Fri, 07 February 2020 17:37]

Report message to a moderator

Re: Would you please help with connection to Oracle through Power Shell ? [message #679125 is a reply to message #679124] Sat, 08 February 2020 01:38 Go to previous messageGo to next message
Michel Cadot
Messages: 67444
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Quote:
tnsname.ora stores at %ORACLE_HOME%\admin\bin.

tnsnames.ora should in %ORACLE_HOME%\network\admin.


In ODBC data source tool, click on Add, then on your Oracle home ODBC driver, then fill the form.

Here's an example from Laurent Schneider.

Re: Would you please help with connection to Oracle through Power Shell ? [message #679126 is a reply to message #679125] Sat, 08 February 2020 01:42 Go to previous message
Michel Cadot
Messages: 67444
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

And another one and Microsoft doc.

Previous Topic: Upgrading from 12c to 18c failing with error: database already upgraded
Next Topic: windows batch file : variable assignment
Goto Forum:
  


Current Time: Wed Oct 21 20:31:33 CDT 2020