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!

how to connect oracle database/table using data control in vb-6 1

Status
Not open for further replies.

nomy

Programmer
Jul 20, 1999
23
PK
how to connect oracle database/table using data control in vb-6
 
Hi Nomy!<br>
<br>
By coincidence, I was just doing this very same thing this week. <br>
<br>
Prerequisites:<br>
I have no references to ADO or DAO in my project. I have the MS Data-bound Grid 5.0 (SP3) component in the toolbox. I have a system DSN defined using the MS Oracle ODBC driver. I have the Oracle 8.0 client software installed (the MS Oracle ODBC driver needs it)<br>
<br>
I dropped a datacontrol onto my form, plus a VB5 Data-bound grid control. The datacontrol properties were set like:<br>
DefaultCursorType = 1-ODBCCursor<br>
DefaultType = 1-UseODBC<br>
RecordsetType = 1-Dynaset<br>
Connect = &quot;ODBC;DSN=MyDSN;UID=MyUID;PWD=MyPwd;DBQ=MySID;&quot;<br>
RecordSource = &quot;select * from GLOB.REPORTWIZ_DEFS;&quot;<br>
<br>
The gridcontrol just points at the datacontrol.<br>
<br>
There are a couple of tricks here. Tbe default cursor type has to be set to ODBCCursor otherwise you get a S1C00 error when you try and update a row. The DefaultType has to be set to UseODBC otherwise Microsoft's Jet drivers try and find an Access database file named MyUID.mdb. The RecordsetType has to be 1-Dynaset because Oracle's cursors only go forwards (not back & forth). The Connect string has to have the DBQ in it so that it can find the correct SID (otherwise you get an annoying signon screen). And lastly, the SQL you use has to have the owner's and tablenames in upper case, otherwise Oracle won't find them (you get a table-not-found error).<br>
<br>
Tbe connection string format that Oracle understands is (case-sensitive):<br>
DSN= ODBC Data Source Name<br>
UID= User ID or username<br>
PWD= Password (Specify PWD=; for an empty password)<br>
DBQ= Service Name<br>
DBA= Database attribute (W=write access, R=Read-only access)<br>
TLO= Translation option<br>
TLL= Translation Library name<br>
PFC= Prefetch count<br>
APA= Applications Attributes (T-Thread Safety Enabled)<br>
<br>
Chip H.<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top