Connecting to Oracle 9i using Visual Basic 6.0

Hi:
I'm using a driver from DataDirect: DataDirect 5.1 Oracle to connect to oracle. I'm able to do test connect Successfully with a tool provided by Data Direct. The OS is Windows 2000 sp4
I'm trying to use a source code I found in Microsoft web site and I get an error
saying "[DataDirect][ODBC Oracle Driver]Insufficient information to connect to
the data source". I think I'm in right direction, but something is missing. This
is my first time trying to connect to Oracle using VB6. Pleas need help:
Option Explicit
Public db As New ADODB.Connection
Public uid As String
Public pwd As String
Public dBase As String
Sub OracleConnect()
On Error GoTo logonError
Dim Conn As String
Dim drv As String
uid = Trim$(frmLogon.txtUserId.Text)
pwd = Trim$(frmLogon.txtPassword.Text)
dBase = Trim$(frmLogon.txtDatabase.Text)
Set db = New ADODB.Connection
With frmLogon
If .txtUserId.Text = "" Then
MsgBox "Please Enter USER ID", vbExclamation
.txtUserId.SetFocus
Exit Sub
ElseIf .txtPassword.Text = "" Then
MsgBox "Please Enter Password", vbExclamation
.txtPassword.SetFocus
Exit Sub
End If
'Connection String
If .txtDatabase.Text <> "" Then
Conn = "UID= " & uid & ";PWD=" & pwd & ";DRIVER={DataDirect 5.1 Oracle};" _
& "SERVER=" & dBase & ";"
Else
Conn = "UID= " & uid & ";PWD=" & pwd & ";DRIVER={DataDirect 5.1 Oracle};"
End If
End With
Screen.MousePointer = vbHourglass
'Connect With ORACLE
With db
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
Screen.MousePointer = vbDefault
logonError:
If Err.Number <> 0 Then
Screen.MousePointer = vbDefault
MsgBox "If Any Error Occured Please Restart the Prog If Reqd. Error Description:" & Err.Description & "", vbCritical
With frmLogon
.txtUserId.Text = ""
.txtPassword.Text = ""
.txtDatabase.Text = ""
.txtUserId.SetFocus
End With
Else
Screen.MousePointer = vbDefault
Unload frmLogon
frmMain.Show
End If
End Sub

I do this way!
1. Create a system DSN from ODBC DataSource ... for example named it "mydsn"
   using 'Microsoft ODBC for Oracle' Driver
2. In VB6, goto project->preferences, and select any "Microsoft Activex Data Objects 2.X library
3. Write the following sample code for test:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "dsn=mydsn", "scott", "tiger"
rs.Open "select *  from emp", cn, adOpenDynamic, adLockOptimistic
MsgBox "Connected to Oracle with scott....",vbinformation
End Sub

Similar Messages

  • How to connect to oracle database from visual basic 2010 express edition

    I have installed visual basic 2010 express edition on windows xp. But visual basic 2010 express edition supports Microsoft sql server database file,Microsoft sql server compact 3.5, Microsoft access database file. I want to connect to oracle database from visual basic 2010 express edition. So what drivers are required and how to do connectivity?

    Hello,
    I wasn't clear on what you were using to make the connection. I had a look in Visual Studio 2010 (don't have express to test sorry).
    I think you mean the Data Sources available under the menu Data-> Datasources. this seems to match the description you give when I
    look at the list of datasource options.
    In here you can make ODBC connections via the Microsoft .net Data Provider .
    If you select ODBC as a datasource you can see listed the DSN's you created - for example I see 2 which use the Oracle ODBC driver.
    This assumes you installed an Oracle Client + the oracle version of the ODBC driver (comes with the oracle client).
    Once you created a server connection then you should see it in the server explorer.
    You can also download the Oracle Developer Tools for Visual Studio which is an add on for VS.
    ** I suspect this is only for VS 2010 and I didn't see that Express was supported.
    http://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index-097110.html
    Let me know if that helps.
    John

  • How to access Oracle Data Base on Unix using Visual Basic ?

    Hi !
    I want to use visual basic and access the Oracle Data Base on Unix server. How can i do that ? Do i need any software?
    .Prashant

    You need an oracle client installation and setup your TNS names.

  • Can we connect to oracle 9i using vb6.0 in 64 bit machine.

    Can we connect to oracle 9i using vb6.0 in 64 bit machine.
    Code i have written is
    dim conn as new ADODB.Connection
    conn.open("Provider=MSDAORA.1;password=pw;user id=usname;data source=dbname;Persist Security info=false")
    but it is throwing an error saying
    "Connection not open"
    But the same code is working in vb.net.
    Do we need to install any providers for 64 bit machine?

    I have had no luck doing this in the 64-bit ODAC or otherwise. If anybody succeeds I would love to hear about it. My experience follows for those interested:
    I am trying to migrate some working VB6 code from Windows 2000 Server to 64-bit Windows Server 2003 but can't get the OLEDB connection to Oracle to work.
    In the working code (x86 environment), I am using ADO 2.8 and Microsoft OLEDB Provider for Oracle (MSDAORA). Since the Microsoft OLEDB provider for Oracle is no longer supported or available on Windows Server 2003 x64, I tried to use the 32-bit Oracle OLEDB provider in ODAC 10.2 but may have run into the parsing bug posted on MSDN (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=159581). Next, I successfully installed the beta 64-bit version of ODAC 10.2, but when I try to open the connection I receive "Error 3706 Provider cannot be found. It may not be properly installed." However, I can successfully TNSPing the data source.
    Windows Server 2003 x64 (not Itanium)
    Oracle Enterprise 9.2
    Microsoft Visual Basic 6
    Microsoft ADO 2.8 (Objects & Recordset references)
    Oracle OLEDB Provider (ODAC 10.2, 64-bit)
    Code Snippet:
    Set m_dbConn = New ADODB.Connection
    With m_dbConn
    .ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=oplprod; User ID=myid; Password=mypwd;"
    .ConnectionTimeout = 10
    .CursorLocation = adUseClient
    .Open
    End With

  • How do I open a pdf stored in a Microsoft Access database using Visual Basic studios 2012

    Currently I am unable to find a valid method of being able to open a pdf stored in a Microsoft Access database using Visual Basic studios 2012. I've tried displaying the entire database on a form, but when I do this all the other columns show up with
    the correct data besides the one containing the pdf's, it just displays <binary data> in each row down the column. I also tried another method with which you use the database as a dataset and can drag and drop the rows and columns into the form, which
    again works for all the other columns besides the one containing the pdf's but this time I'm unable to interact with the column  at all. 
    Not too sure if this is in the correct place, but any answers or help would be appreciated. Cheers.

    Alex,
    This forum is dedicated to Project and Project Server. You might get better response, if you post to a Visual Basic forum. Here are couple I could find. 
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Cvblanguage&filter=alltypes&sort=lastpostdesc
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • Can I use Visual Basic to covert form user data from multiple .pdf files to a single .csv file?

    Can I use Visual Basic to covert form user data from multiple .pdf files to a single .csv file?  If so, how?

    You can automate Acrobat using IAC (InterApplication Communications), as documented in the Acrobat SDK. Your program could loop through a collection of PDFs, load them in Acrobat, extract the form data from each, and generate a CSV file that contains the data.
    Acrobat can also do this with its "Merge Data Files into Spreadsheet" function, but this is a manual process.

  • Connect to oracle database using c program

    I am using AIX environment and i want to connect to oracle database using c program.

    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10825/pc_03dbc.htm#i5880

  • Can anyone help i want to call java class using visual basic

    I want to call java class using visual basic and send some arguments to the main class

    Hi,
    I don't know VB, but you can surely launch a command line like :
    javaw.exe mypackage.MyMainClass myArgument1
    Regards

  • Need help creating full battery alert using visual basic script

    Hi,
    I have been searching for resources, programs and code that will create an alert for me to unplug my charger when my laptop
    battery is charged to full (or almost full).
    The only problem with this code is that
    Line 13: iRemaining (or RemainingCapacity called from BatteryStatus returns a 0 (might be a floating point which I can't figure out why). I even checked the microsoft documentation and its supposed to be a percentage.
    I want to get either the current percentage of the battery or the total Fullchargedcapacity and the EstimatedRemainingCapacity to find the % of battery level.
    Essentially what I am asking is how can I return the battery % using visual basic script.
    Help!
    The Code:
    1 set oLocator = CreateObject("WbemScripting.SWbemLocator")
    2 set oServices = oLocator.ConnectServer(".","root\wmi")
    3 set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity")
    4 for each oResult in oResults iFull = oResult.FullChargedCapacity
    5 next
    6
    7 while (1)
    8 set oResults = oServices.ExecQuery("select * from batterystatus")
    9 for each oResult in oResults
    10 iRemaining = oResult.RemainingCapacity
    12 bCharging = oResult.Charging
    12 next
    13 iPercent = ((iRemaining / iFull) * 100) mod 100
    14 if bCharging and (iPercent > 95) Then msgbox "Battery is at " & iPercent "%",vbInformation,"Battery monitor"
    15 wscript.sleep 30000 ' (30 seconds)
    16 wend

    14 if bCharging and (iPercent > 95) Then msgbox "Battery is at " & iPercent "%",vbInformation,"Battery monitor"
    On my Windows 7 machine your script returns the desired percentage (after adding the missing "&" to the right of "iPercent" in Line 14).

  • How do i detect DAQ device number programatticaly using Visual Basic (not using MAX)?

    how do i detect DAQ device number programatticaly using Visual Basic (not using MAX)?

    Several of the CWDAQ objects have Device (the device number), DeviceName, and DeviceType properties that I think will give you the information that you're looking for. For more information, look in the index of the Measurement Studio reference for Device, DeviceName, and DeviceType.
    - Elton

  • Oracle DLL Error using AQ (in Oracle 10g) from Visual Basic

    Hi, everybody
    I have a Visual Basic 6 (with SP 6) application which connect to Oracle through an ODBC connection. Not only the client but also the server use Oracle 10.2.0.3.
    The application accesses to Oracle Queues by using OraAQ, OraDatabase, OraSession... objects.
    Everything works all right until the moment of closing the application; when the OraAQ object is disposed, an error in a DLL occurs. The DLL is orageneric10.dll, and it causes a Windows error which closes the application. Windows XP is used as operating system.
    The error only happens with the OraAQ object; other objects are disposed without any problem.
    Please, if somebody have an explanation, let me know. It is a very important issue for us.
    Thanks in advance

    Has anyone discovered an answer to this yet? I get the same issue, but am struggling to find a solution anywhere.
    (VB.NET on Visual Studio 2005, Flash CS5, Flash Player 10.1.85.3, AS3)

  • Connecting to Oracle database using c# project

    I m new to oracle database, Right now I am using oracle 10g XE,some how I have created all the tables procedures etc I am able to connect to the same using sqlplus/server explored/XE
    but while connecting via c# code I am getting invalid username/password error
    my connection string is
    <add key="ServerDB" value="Provider=MSDAORA;Data Source=localhost;uid=xyz;pwd=xyz"/>
    please help me in this
    I m not sure whether the provider name I m using is correct or not. please help

    For the Microsoft OleDb Provider for Oracle the connection string should look like the following:
    Provider=msdaora;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword
    Note that it's User ID and not UID. You can find more examples below, depending upon which driver/provider that you are using:
    http://www.connectionstrings.com/oracle/
    Paul ~~~~ Microsoft MVP (Visual Basic)

  • How to read an APO table from excel in place using Visual Basic ?

    We have enhanced some APO reports using layouts that use excel in place with custom visual basic (VB) code. For example, the VB code can append the data with additional columns that perform specific calculations and then proceed to create pivot table reports in excel..That is working fine.
    The challenge is to see if that VB code could read specific APO tables (e.g. product master tables) to bring additional elements into excel and thus expand the report content. We know that additional fields can be added to the reports, but having the flexibility to read tables from VB could be more flexible.
    Can that be done?. If so, would it be possible using exclusively the VB code attached to the layout, i.e. no ABAP?

    Hello Anselmo,
    I am assuming you are doing this either using BeX analyzer or by reading the planning book using the RFC ActiveX component and a BAPI.
    I think it's possible to retrieve the data from the product master table. Here are my thoughts on how can this be done:
    1) You can create a generic datasource (transaction RSO2) for the product master table, connect that to a BW remotecube and use a BeX query to retrieve that values. You can then join the queries using VBA. Alternatively, you can build a muti-provider that connects your current InfoCube to the new RemoteCube and build a query from there. The multi-provider, in this case, joins the data (no more VBA).
    2) If you have already loaded your product master data into master data carrying InfoObjects then you can try the same technique as #1 but this time there is no need to create the generic datasource. You can use the InfoObjects for your master data as the InfoProviders for your query.
    3) You can try the ActiveX component from SAP which can  connect to any emote enabled function in SAP system. SAP already provided some BAPIs (check transaction BAPI for a list) which might be able to provide the data. You can also create your own function modules (be sure to make it remote enabled) using ABAP. (transaction SE37).
    Hope this helps

  • Tcp/ip ni-visa commands using visual basic

    what are the dll and bas files i need to communicate with a device via rj45 cable thru visbual basic , i can communicate when i use hyperterminal but i can't via visual basic
    tcpip::192.168.48.11:: this is where i'm stuck
    Solved!
    Go to Solution.

    hi,
    thanks i found that file. we recently purchased a gpib to usb and i used the call commands and everything worked out fine via visual basic i was able to talk to the device and everything.
    but i'm still stuck on how to connect to the device via ethernet cable. my address is 192.168.48.11
    so the way i have to write is  viWrite&(ByVal vi&, ByVal buf$, ByVal count&, retCount&) 
    i have no clue what all that stuff means this is how far i got what do i put after the ipaddress?
    viWrite&(tcpip::192.168.48.11
    do you guys have examples for this, if i can't figure it out can we pay national instruments for a software engineer to help us write a program,

  • Oracle SQL/ Excel Visual Basic Consulting Opportunity in New York City

    Hello:
    Is anyone interested in a consulting opportunity?
    I am marketing director for a catalog/internet business in Manhattan. I am running Oracle 9.2i . We use the datawarehouse for many marketing/merchandising reports. I have SQL code embedded in Excel workbooks using an ODBC interface. The SQL code gets the data and then I have a lot of Visual Basic macros that run and create the reports.
    I need someone to come in and help me optimize the queries and macros (since I am self-taught on both SQL and VB there is LOTS of room for improvement).
    Since some of the reports are popular, I am getting overwhelmed with requests for new reports and it is taking time away from my marketing responsibilities.
    If anyone out there is interested, please let me know
    Thanks

    Hello:
    Is anyone interested in a consulting opportunity?
    I am marketing director for a catalog/internet
    business in Manhattan. I am running Oracle 9.2i .Sounds interesting, but as you can see in my profile, I'm not able to just "come in". Maybe someone else here wants to pick up this opportunity.
    We use the datawarehouse for many
    y marketing/merchandising reports. I have SQL code
    embedded in Excel workbooks using an ODBC interface.Reminds me of one of my customers that had a ms access frontend and oracle backend.
    The SQL code gets the data and then I have a lot of
    f Visual Basic macros that run and create the
    reports. Memories comin' back ... ;-)
    I need someone to come in and help me optimize the
    queries and macros (since I am self-taught on both
    SQL and VB there is LOTS of room for improvement). I'd say one approach could be to move some of the logic to views or pipelined functions, maybe ref cursors.
    Since some of the reports are popular, I am getting
    overwhelmed with requests for new reports and it is
    taking time away from my marketing responsibilities.Maybe it's also time to rethink the tool selection? ms access or a decent report generator could be an option.
    C.

Maybe you are looking for

  • Connect SQL server source from OWB

    Hi, I have to connect to SQL Server source from OWB. I am using OWB 10.2 version and Owb is installed on UNIX platform. I have created system DSN, made respective entries in hs/admin and edited listener.ora file. In OWB Non-Oracle sorces trying to co

  • ITunes keeps removing all of my songs, please help!

    I recently bought a new laptop and installed the vista 64 bit version of itunes, i copied everything from my iphone into a folder on my laptop, I then dragged all the songs into itunes, everything imported fine and plays fine, but after a day or so i

  • LABVIEW - MAKING A SIMPLE oscillosco​pe

    Hi, I have a project to make an oscilloscope using labview. Ive connected a function generator and sweep function generator to an xy graph. I can play with it through frequency and amplitude. The problem is: how do I make a control for TIME per Divis

  • I lost some new photos because I'm stupid!

    Hey there everyone. I recently was importing some new pictures off my camera, and the import kept locking because my hard drive was full. I'd throw out some stuff, and then try again, but it kept happening. So finally I went into the iPhoto files in

  • SAP WAS 6.40 Installation

    Hello Friends,    Today i tried to install SAP WAS 6.40 on a standalone system with a MS Loopback Adapter enabled. After the admin password screen i got an error dialog. I checked out the log file and found an error entry that says... ERROR 'CJS-0008