If you are running Windows IIS Web server and serving ASP Web pages, you can get data from Oracle servers into your ASP pages through ODBC drivers. To do this, you need to install the correct Oracle ODBC driver and define a DSN on the IIS Web server.
Then you can use ADODB objects to connect to the Oracle server over the ODBC driver in your ASP pages. The tutorial example below gives you a good example:
<%
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "DSN=ggl_DSN;UID=ggl;PWD=retneclgg"
Set oRS = oConn.Execute("SELECT * FROM dev_faq")
Response.write("<p>Data from Oracle server via ODBC:")
Response.write("</pre>")
Do While NOT oRS.EOF
Response.Write(oRS("ID") & vbcrlf)
oRS.MoveNext
Loop
Response.write("</pre>")
oRS.close
oConn.close
%>
Once you got a DSN defined in the ODBC manager that connects to an Oracle server, you can connect a normal MS Access document to the Oracle server, and link an Access table to Oracle table. The tutorial below gives you a good example:
► Start MS Access with a new database file.
► Go to File menu.
► Select Get External Data.
► Select Import.... The Import dialog box shows up.
► Select Files of type: ODBC Database(). The Select Data Source dialog box shows up.
► Click the Machine Data Source tab. You should see the DSN name "ggl_DSN" you defined earlier.
► Select "ggl_DSN".
► Enter User Name: ggl.
► Enter Password: retneclgg.
You should see the Oracle ODBC Driver Connect dialog box as shown in the picture below:
Import Oracle tables to MS Access
Click the OK button to continue. You should see a list of tables available for you to import from the Oracle server as shown in the picture below:
Importing Oracle tables via ODBC
DSN (Data Source Name) is an ODBC connection identifier for Windows applications. Here is how you can define a DSN on your Windows system:
► Go to Control Panel.
► Go to Administrative Tools.
► Run Data Sources (ODBC).
► Go to System DSN tab.
► Click the Add button.
► Select the "Oracle in XE" driver.
► Enter Data Source Name: ggl_DSN.
► Enter Description: globalguideline DSN Oracle Setting.
► Enter TNS Service Name: XE.
► Click the Test Connection button.
► Enter User Name: ggl.
► Enter Password: retneclgg.
► Click the OK button.
You should see a "Connection successful" as shown in the following picture:
DSN Setting for Oracle ODBC Driver
If you have installed an Oracle server or an Oracle client tool on your local system, the TNS is automatically installed with a simple configuration file, tnsnames.ora, to define Oracle connect identifiers.
For example, if you have Oracle XE server installed, you will have the tnsnames.ora located at oraclexeapporacleproduct10.2.0serverNETWORKADMIN. It should contain a connect identifier called XE defined as:
XE =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)(HOST = localhost)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
If you want to follow the tutorial exercises in the sections below, you need to create a user account and a table for ODBC connection testing as shown here:
SQL> CONNECT system/retneclgg
Connected.
SQL> CREATE USER ggl IDENTIFIED BY retneclgg ACCOUNT UNLOCK;
User created.
SQL> GRANT CREATE SESSION TO ggl;
Grant succeeded.
SQL> GRANT CREATE TABLE TO ggl;
Grant succeeded.
SQL> ALTER USER ggl DEFAULT TABLESPACE USERS;
User altered.
SQL> ALTER USER dev QUOTA 4M ON USERS;
User altered.
SQL> connect ggl/retneclgg;
Connected.
SQL> CREATE TABLE dev_faq (id NUMBER);
SQL> INSERT INTO dev_faq VALUES (3);
SQL> INSERT INTO dev_faq VALUES (5);
SQL> INSERT INTO dev_faq VALUES (7);
Webmaster 22nd of May 2012
Tell us what you feel about Basic Oracle Concepts and Programming Interview Questions and Answers
All comments will be published after review. No login or registration is required to post a comment on Basic Oracle Concepts and Programming Interview Questions and Answers We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
So start sharing your thoughts regarding Basic Oracle Concepts and Programming Interview Questions and Answers
Thank you.