473,388 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

automating oracle ODBC driver connect login

Any way to avoid having to manually enter my user name & password for
the Oracle login box? I normally run a query on an attached Oracle
table and have to enter the un/pw before the query will run. There's
no place to enter this information in. Later, if I run subsequent
queries on the table in question, I don't need to enter un/pw again. I
can leave my PC on 24x7, but that's not really a solution. I need to
know if I can log in to the database by opening the table via an ADO
recordset, passing the user/pw and then closing it, and having the
current file session maintain that info so I can automate subsequent
queries.
That was a mouthful, so please let me know if I confused anyone
besides myself.

Thanks
Nov 12 '05 #1
2 7924
If you do an ODBC link, there should be a checkbox that asks if you want
the link to remember your login so that you don't get prompted all the
time.

As for ADO, here is some code you could try:

Dim conn As New ADODB.Connection, i As Long, j As Long
Dim Rst As New ADODB.Recordset, RS As DAO.Recordset

conn.Provider = "OraOLEDB.Oracle"
conn.ConnectionString = "Data Source=ccc" & _
";User ID=Steve;Password=tiger"
conn.Open
Rst.CursorLocation = adUseClient
Rst.Open "SELECT someDatefld FROM dbo.OracleTable WHERE someDatefld >=
TO_DATE('01-01-02', 'DD-MM-YY')", conn
'copy data from Rst to RS
...
Rst.Close
conn.close

The interesting thing about using Ado with Oracle (com ADO) is that you
reference the ODBC dsn (ccc in this example) as your datasource instead
of the server. If you have an ODBC dsn then the Oracle Client service
is obviously installed on your computer (which is the only way to get
the working Oracle ODBC driver). And to reference the Oracle table
correctly (dbo.OracleTable is an arbitrary table name) you need to set a
tableDef object variable to the ODBC linked table and do a debug.Print
tdf.SourceTableName to see what the table name actually is (usually
OracleServiceName.tablename)

Dim tdf As TableDef
Set tdf = CurrentDB.TableDefs("yourODBCoracleTable")
Debug.Print tdf.SourceTableName

One last note, pl Sql (oracle sql) uses slightly different syntax than
jet sql (or Tsql - sqlserver sql). You have to cast stuff (like
datefields - using To_Date function in PL sql).

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2
Rich, thanks for the detailed post. I finally got caught up enough to
even read this. I will hopefully have time this week to try your
suggestions.

Thanks again.

JV

Rich P <rp*****@aol.com> wrote in message news:<40*********************@news.frii.net>...
If you do an ODBC link, there should be a checkbox that asks if you want
the link to remember your login so that you don't get prompted all the
time.

As for ADO, here is some code you could try:

Dim conn As New ADODB.Connection, i As Long, j As Long
Dim Rst As New ADODB.Recordset, RS As DAO.Recordset

conn.Provider = "OraOLEDB.Oracle"
conn.ConnectionString = "Data Source=ccc" & _
";User ID=Steve;Password=tiger"
conn.Open
Rst.CursorLocation = adUseClient
Rst.Open "SELECT someDatefld FROM dbo.OracleTable WHERE someDatefld >=
TO_DATE('01-01-02', 'DD-MM-YY')", conn
'copy data from Rst to RS
..
Rst.Close
conn.close

The interesting thing about using Ado with Oracle (com ADO) is that you
reference the ODBC dsn (ccc in this example) as your datasource instead
of the server. If you have an ODBC dsn then the Oracle Client service
is obviously installed on your computer (which is the only way to get
the working Oracle ODBC driver). And to reference the Oracle table
correctly (dbo.OracleTable is an arbitrary table name) you need to set a
tableDef object variable to the ODBC linked table and do a debug.Print
tdf.SourceTableName to see what the table name actually is (usually
OracleServiceName.tablename)

Dim tdf As TableDef
Set tdf = CurrentDB.TableDefs("yourODBCoracleTable")
Debug.Print tdf.SourceTableName

One last note, pl Sql (oracle sql) uses slightly different syntax than
jet sql (or Tsql - sqlserver sql). You have to cast stuff (like
datefields - using To_Date function in PL sql).

Rich

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex | last post by:
I have developed a VB application that uses Oracle 8i database for backend. The database server is on the local network. From my development machine, the application connects (via ODBC) to the...
0
by: Kong Li | last post by:
Follow up to this thread, the latest Oracle 9i release 2 patchset (9.2.0.5) fixed the handle count leak problem. The problem is in Oracle client component. Thanks. Kong ----- From: Kong...
5
by: SerGioGio | last post by:
Hello, I am going nuts. I am trying to connect to my local ORACLE instance using ODBC. It used to work few weeks ago, but it fails now. Connection with: - SQL*plus: connection works! -...
12
by: Jerry Weinstein | last post by:
Hi, I know about stored procedures and that they can speed up data entry via the SQL 'insert ' statement. However, one drawback to this method is that using the stored procedure still requires...
5
by: jrefactors | last post by:
My machine is Windows XP with Oracle 9.2 Home; IIS and Oracle are in the same box. I have tried both Oracle OLEDB Provider and Microsoft ODBC For Oracle, but both not working. For Microsoft...
2
by: jmev7 | last post by:
Any way to avoid having to manually enter my user name & password for the Oracle login box? I normally run a query on an attached Oracle table and have to enter the un/pw before the query will run....
3
by: Andrew McGregor | last post by:
Hi, I am trying to get a VB.NET application to connect to a local Oracle 9i Lite database. What is the correct form for a connect string? cn = New...
2
by: Crazy Cat | last post by:
Hi all, I am having trouble getting linked Oracle 9 server in MS SQL Server 2005 Express to work properly. My machine is running Windows XP. The Microsoft and Oracle OLE DB Providers have...
10
by: Reedsp | last post by:
Version: MSAccess 2003 SP2 Explination: I have a database that connects to an oracle database. I have setup an ODBC connection under the System DSN tab in the ODBC Source Administrator. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.