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
https://forums.phpfreaks.com/topic/155850-asp-java-oracle/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.