Solved

applet<---->servlet(oracle oci driver)<----->oracle database?

Posted on 2001-06-19
8
260 Views
Last Modified: 2013-11-24
Hi everybody,
   I try to access oracle database by oci driver using servlet.anybody can tell me how to do it?
  thanks.
0
Comment
Question by:li6183
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 3

Expert Comment

by:superschlonz
ID: 6208346
Driver driver = Class.forName( "oracle.jdbc.driver.OracleDriver" ).newInstance();
DriverManager.registerDriver( driver );
Connection conn = DriverManager.getConnection( "jdbc:oracle:oci8:@<tnsname>", "user", "pass" );

Have also a look at: http://technet.oracle.com/tech/java/jroadmap/jdbc/listing.htm#998514
0
 
LVL 3

Expert Comment

by:superschlonz
ID: 6208354
An more informations about JDBC you find at:
http://java.sun.com/products/jdbc/
0
 
LVL 4

Expert Comment

by:rdov
ID: 6209360

   try {
       Class.forName("oracle.jdbc.driver.OracleDriver");
       Connection con = DriverManager.getConnection("jdbc:oracle:thin:@orads:1521:ecart","ecart","ecart");

("jdbc:odbc:test","ecart","ecart");
       con.setAutoCommit( false );

       Statement stmt;
          stmt = con.createStatement();
       String queryString = "select * from Categories";
       ResultSet rs = stmt.executeQuery(queryString);
       boolean moreNames = true;
       if (!(rs.next())) {
          moreNames = false;
       }

        while (moreNames) {
           while (rs.next()) {
               String s = rs.getString("cat_name");

               out.println("Category ID: " + s + "
");
         if (!(rs.next())) moreNames = false;
       }
    }
       // print out decent error messages

    catch(SQLException SQLe) {
      out.println("Message:   " + SQLe.getMessage ());
         out.println("SQLState:  " + SQLe.getSQLState ());
         out.println("ErrorCode: " + SQLe.getErrorCode ());
 }
 catch (ClassNotFoundException e) {
   out.println("Message:   " + e.getMessage ());

 }

http://developer.java.sun.com/developer/onlineTraining/Database/JDBCShortCourse/index.html

http://wpi.wpi.edu/java.815/a64685/basic1.htm#1004398

http://otn.oracle.com/tech/java/jroadmap/jdbc/listing.htm

download classes12.zip JDBC driver from:
http://otn.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm

0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:li6183
ID: 6210539
thanks, everybody,what rdov wrote is for oracle thin driver,and it is not exactly what I want.I try to implement applet communicate with servlet, and servlet runs at apache web server, and it will access oracle database. I can implement it using oracle thin driver. but as you know, if you using thin driver, you  must specify the oracle server name(hostname) and port number. if you want to access different database server, you must change the hostname in your source code. it is not good. so I want to use oracle oci driver, and I can access just by <tnsname>.anybody knows what I should deploy apache web server in order to use oracle oci driver?
 
0
 
LVL 4

Accepted Solution

by:
rdov earned 50 total points
ID: 6210867
0
 

Author Comment

by:li6183
ID: 6211689
thanks rdov,I have read the white page what you offered(http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/jdbcwhpap.htm).inside this article,there are two methods about
JDBC/OCI Driver 3-Tier Configuration(A and B). I am confused about them, what I did is very similar with configuration B,the different is that the configuration B said the protocol between applet and servlet is either RMI or COBRA(IIOP), but I used http protocol. I don't know whether or not it is viable?


 
0
 
LVL 4

Expert Comment

by:rdov
ID: 6213551
if the servlet communicates with the ORACLE DB it should be fine to send the retrieve data to the applet through http protocol. but if the applet needs to communicate the DB directly it should be a problem to do this through http protocol without thin driver.
0
 

Author Comment

by:li6183
ID: 6214342
yes rdov,I have same idea with you,so I don't know why the whitepage say so.by the way, if you want to use applet communicate with DB directly, maybe the ids driver is better than thin driver.
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question