Solved

VB code to set Oracle service name and address etc.

Posted on 2004-03-23
5
323 Views
Last Modified: 2013-12-25
Is it possible to rest the Oracle service names of my Oracle databases in VB rather than using the Oracle tools net manager etc?
I have an app that needs to point at different db and I'd not have to switch out of the app and to net manager to do it.
0
Comment
Question by:Sparky191
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ajgilbert earned 500 total points
ID: 10657238
Sparky191,

Are all the database SID's are set up in your TNSNAMES.ORA file ?, if they are then switching between databases from VB is easy - you just change the server name in your connection string, and then re-connect to the new database.


0
 
LVL 5

Expert Comment

by:ajgilbert
ID: 10657266
For example, the below will switch an ADO data control between 'database1' and 'database2'

Adodc1.ConnectionString = "Provider=MSDAORA.1;Password=pass;User  ID=user;Data Source=database1;Persist Security Info=True"
Adodc1.Refresh

Adodc1.ConnectionString = "Provider=MSDAORA.1;Password=pass;User ID=user;Data Source=database2;Persist Security Info=True"
Adodc1.Refresh


0
 
LVL 1

Author Comment

by:Sparky191
ID: 10657436
I should clarify. My VB app will configure the connection for another app that uses the database SID's. So I guess just changing that TNSNAMES.ORA file will be all I need to do.
0
 
LVL 1

Expert Comment

by:ajysen
ID: 10677682
i recommend u to use ini file for storing the database name, user name and password. so every time u starts the app, ur app will connect to the database defined in the ini file. For doing so u have to retreive the setting from the ini file.

Also u can change the setting of the ini file through VB app.

Hope this will solve ur problem.
0
 
LVL 1

Author Comment

by:Sparky191
ID: 10698042
Just changing the string works fine thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question