Jump to content

ASP + Java + Oracle


Hybride

Recommended Posts

I've been trying to retrieve a query using ASP through Java on an Oracle db, to no avail. With quotes, the query comes up blank; without quotes, the entire query is used. If I rename "symbol" to anything but "symbol", I get an error ("invalid identifier"). It's running on localhost. Any help greatly appreciate. :]

 

<body>

<%@ page import="java.sql.*" %>
<p align="center"><h1>TRANSACTION SYSTEM</h1>
<form action="member.jsp" method=POST>
SECURITY NAME (4 Symbols): <input name=symbol type=text maxlength=4 width=20>

<input type="submit" value="submit">


<% // 
  try {
     //Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
     Class.forName("oracle.jdbc.driver.OracleDriver");
     java.sql.Connection conn;
     conn = DriverManager.getConnection(
        "jdbc:oracle:thin:@oracle.cs.luc.edu:1521:orcl","xxx","xxxx");
     Statement stmt = conn.createStatement();
     ResultSet rs = stmt.executeQuery("select * from security WHERE symbol='symbol'");
   %>

<table border=2 cellpadding=5 cellspacing=5>
   <tr>
     <th>SYMBOL</th>
     <th>CNAME</th>
     <th>FNAME</th>
   </tr>
<%

     while (rs.next()) {
	 String symbol = rs.getString(1);
	 String cname = rs.getString(2);
     /*  String mid   = rs.getString(1);
       String lname = rs.getString(3);
       String fname = rs.getString(4);
   */
%>
       <tr>
         <td><%= symbol%></td>
         <td><%= cname%></td>
         <td><%= cname%></td>
       </tr>
<%   }
     rs.close();
     stmt.close();
     conn.close();
%>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.