Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vb6 and Oracle Connection

Status
Not open for further replies.

zqtqzq

Programmer
Jul 23, 2003
61
A2
pls i have a machine running oracle server running oracle 9i, i want to write a vb6 application to extract a data from a table in the oracle database, i have seen the oledb and odbc connection string but how can i determine the following

1. The server Name
2. The Database to use
3. Other parameters that i may need to get my connection string working

once my connection string to Oracle is ok i know what to do next.

kindly help, i am in a tight schedule.

thank u
 
Well this is how I connect to Oracle

Dim sConn as String
sConn = "UID=MyUserName;PWD=MyPassword;DSN=MyDSN;"

Call OpenConn(sConn)
_______________________________________________________________


Option Explicit
Public g_dbConn As rdoConnection
Public g_dbEnv As rdoEnvironment
Public g_sPsDataPath As String

Public Sub OpenConn(sConn As String)
On Error GoTo ErrorHandler

Set g_dbEnv = rdoEnvironments(0)
Set g_dbConn = g_dbEnv.OpenConnection(dsName:="", Connect:=sConn)

Exit Sub
ErrorHandler:
Call ErrorRoutine("modDatabase:OpenConn:" & Err.Description)
End Sub

Hope this helps
 
search this site for "connection" and "strings" and you will find plenty of threads with a link to one or two sites with all type of connection strings.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
I have all this connection strings but my problem is in the process of creating the DSN using Microsoft ODBC what will the Server be?


i get this error while creating the Oracle dsn

ORA 01034 - Oracle not available
ORA 12154 - TNS could not resolve service Name

i am using the account SYSTEM as userID
and manager as the password to log to the Oracle

Any assistance will be appreciated
 
Take a look at this thread thread709-319900

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
How can you have your connection string without setting up the DSN
 
can't remember where i got this from:


Private Sub Form_Load()
Dim oDataLinks As Object
Dim sRetVal As String

Set oDataLinks = CreateObject("DataLinks")
On Error Resume Next
sRetVal = oDataLinks.PromptNew
On Error GoTo 0
If Trim(sRetVal) <> "" Then
InputBox "Your Connection String Is Listed Below", "OLEDB Connection String", sRetVal
End If

Set oDataLinks = Nothing

Unload Me

End Sub
 
Here's how I connect to oracle without DSN
Dim dbConn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String

dbConn.Open "Driver={Microsoft ODBC for Oracle};" & _
"Server=" & gDatabase & ";" & _
"Uid=" & gDatabaseUser & ";" & _
"Pwd=" & gDatabasePassword
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top