Quotes in java ser pages and SQL

I am french.
Thursday, April 04, 2002 8:02 PM
Hi all,
I have a memo field in Ultradev (and some text fields) that are inserted into an Filemaker database when the form is submitted.... nothing too exciting, but, i now have to be able to have apostrophes in the text & memo fields. When i have an apostrophe in the field, my application Server (JRUN 3.1) an error occurs - the apostrophe indicates the end of the string to submit to the database. When i don't print apostrophes in the text field, everything is ok.
Please try to help me as soon as possible
Thanks, Arnaud
It is urgent .
<%@page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
<%
// *** Logout the current user.
String MM_Logout = request.getRequestURI() + "?MM_Logoutnow=1";
if (request.getParameter("MM_Logoutnow") != null && request.getParameter("MM_Logoutnow").equals("1")) {
  session.putValue("MM_Username", "");
  session.putValue("MM_UserAuthorization", "");
  String MM_logoutRedirectPage = "../index.jsp";
  // redirect with URL parameters (remove the "MM_Logoutnow" query param).
  if (MM_logoutRedirectPage.equals("")) MM_logoutRedirectPage = request.getRequestURI();
  if (MM_logoutRedirectPage.indexOf("?") == -1 && request.getQueryString() != null) {
    String MM_newQS = request.getQueryString();
    String URsearch = "MM_Logoutnow=1";
    int URStart = MM_newQS.indexOf(URsearch);
    if (URStart >= 0) {
      MM_newQS = MM_newQS.substring(0,URStart) + MM_newQS.substring(URStart + URsearch.length());
    if (MM_newQS.length() > 0) MM_logoutRedirectPage += "?" + MM_newQS;
  response.sendRedirect(response.encodeRedirectURL(MM_logoutRedirectPage));
%>
<%@ include file="../Connections/webpaf.jsp" %>
<%
// *** Edit Operations: declare variables
// set the form action variable
String MM_editAction = request.getRequestURI();
if (request.getQueryString() != null && request.getQueryString().length() > 0) {
  MM_editAction += "?" + request.getQueryString();
// connection information
String MM_editDriver = null, MM_editConnection = null, MM_editUserName = null, MM_editPassword = null;
// redirect information
String MM_editRedirectUrl = null;
// query string to execute
StringBuffer MM_editQuery = null;
// boolean to abort record edit
boolean MM_abortEdit = false;
// table information
String MM_editTable = null, MM_editColumn = null, MM_recordId = null;
// form field information
String[] MM_fields = null, MM_columns = null;
%>
<%
// *** Update Record: set variables
if (request.getParameter("MM_update") != null &&
    request.getParameter("MM_recordId") != null) {
  MM_editDriver     = MM_webpaf_DRIVER;
  MM_editConnection = MM_webpaf_STRING;
  MM_editUserName   = MM_webpaf_USERNAME;
  MM_editPassword   = MM_webpaf_PASSWORD;
  MM_editTable  = "modules";
  MM_editColumn = "a_code_module_paf";
  MM_recordId   = "'" + request.getParameter("MM_recordId") + "'";
  MM_editRedirectUrl = "merci_maj.jsp";
  String MM_fieldsStr = "titre_dispositif|value|a_titre_module|value|a_public|value|a_objectif|value|a_contenu|value|a_methode|value|lieu_stable|value|a_observation|value";
  String MM_columnsStr = "titre_dispositif|',none,''|a_titre_module|',none,''|a_public|',none,''|a_objectif|',none,''|a_contenu|',none,''|a_methode|',none,''|lieu_stable|',none,''|a_observation|',none,''";
  // create the MM_fields and MM_columns arrays
  java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_fieldsStr,"|");
  MM_fields = new String[tokens.countTokens()];
  for (int i=0; tokens.hasMoreTokens(); i++) MM_fields[i] = tokens.nextToken();
  tokens = new java.util.StringTokenizer(MM_columnsStr,"|");
  MM_columns = new String[tokens.countTokens()];
  for (int i=0; tokens.hasMoreTokens(); i++) MM_columns[i] = tokens.nextToken();
  // set the form values
  for (int i=0; i+1 < MM_fields.length; i+=2) {
    MM_fields[i+1] = ((request.getParameter(MM_fields)!=null)?(String)request.getParameter(MM_fields[i]):"");
// append the query string to the redirect URL
if (MM_editRedirectUrl.length() != 0 && request.getQueryString() != null) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + request.getQueryString();
%>
<%
// *** Update Record: construct a sql update statement and execute it
if (request.getParameter("MM_update") != null &&
request.getParameter("MM_recordId") != null) {
// create the update sql statement
MM_editQuery = new StringBuffer("update ").append(MM_editTable).append(" set ");
for (int i=0; i+1 < MM_fields.length; i+=2) {
String formVal = MM_fields[i+1];
String elem;
java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_columns[i+1],",");
String delim = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
String altVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
String emptyVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
if (formVal.length() == 0) {
formVal = emptyVal;
} else {
if (altVal.length() != 0) {
formVal = altVal;
} else if (delim.compareTo("'") == 0) {  // escape quotes
StringBuffer escQuotes = new StringBuffer(formVal);
for (int j=0; j < escQuotes.length(); j++)
if (escQuotes.charAt(j) == '\'') escQuotes.insert(j++,'\'');
formVal = "'" + escQuotes + "'";
} else {
formVal = delim + formVal + delim;
MM_editQuery.append((i!=0)?",":"").append(MM_columns[i]).append(" = ").append(formVal);
MM_editQuery.append(" where ").append(MM_editColumn).append(" = ").append(MM_recordId);
if (!MM_abortEdit) {
// finish the sql and execute it
Driver MM_driver = (Driver)Class.forName(MM_editDriver).newInstance();
Connection MM_connection = DriverManager.getConnection(MM_editConnection,MM_editUserName,MM_editPassword);
PreparedStatement MM_editStatement = MM_connection.prepareStatement(MM_editQuery.toString());
MM_editStatement.executeUpdate();
MM_connection.close();
// redirect with URL parameters
if (MM_editRedirectUrl.length() != 0) {
response.sendRedirect(response.encodeRedirectURL(MM_editRedirectUrl));
%>
<%
String modules__MMColParam = "1";
if (request.getParameter("choix") !=null) {modules__MMColParam = (String)request.getParameter("choix");}
%>
<%
Driver Drivermodules = (Driver)Class.forName(MM_webpaf_DRIVER).newInstance();
Connection Connmodules = DriverManager.getConnection(MM_webpaf_STRING,MM_webpaf_USERNAME,MM_webpaf_PASSWORD);
PreparedStatement Statementmodules = Connmodules.prepareStatement("SELECT a_contenu, a_public, a_observation, a_methode, a_objectif, a_code_module_paf, a_chapitres_clair, a_titre_module, lieu_stable, a_affiche_modalites, a_affiche_type_module_texte_clair, titre_dispositif FROM modules WHERE a_code_module_paf = '" + modules__MMColParam + "' ORDER BY a_code_module_paf ASC");
ResultSet modules = Statementmodules.executeQuery();
boolean modules_isEmpty = !modules.next();
boolean modules_hasData = !modules_isEmpty;
Object modules_data;
int modules_numRows = 0;
%>
<html><!-- #BeginTemplate "/Templates/mod_indenti.dwt" -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>Plan acad&eacute;mique de formation 2002/2003 de l'Acad&eacute;mie de Cr&eacute;teil</title>
<!-- #EndEditable -->
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta NAME="Author" CONTENT="Cellule Acad�mique de Formation de l'Acad�mie de Cr�t�il">
<meta NAME="Keywords" CONTENT="stages, dispositifs, modules, formation, apprentissage, tice, p�dagogie, enseignement,professeurs, lyc�e, coll�ge, �cole, pr�paration au concours, agr�gation">
<meta NAME="Description" CONTENT="Listes des dispositifs et modules du plan acad�mique de formation de l'acad�mie de Cr�teil">
<meta NAME="GENERATOR" content="Macromedia dreamweaver Ultradev4">
<META NAME=Robots CONTENT=All>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../css/couleurs.css" type="text/css">
<script language="JavaScript">
<!--
function addToFavorite(favTitle){
if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
window.external.AddFavorite(location.href, unescape(favTitle));
//-->
</script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0" width="710">
<!-- fwtable fwsrc="bandeau.png" fwbase="bandeau.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
<tr>
<td width="710">
<table border="0" cellpadding="0" cellspacing="0" width="700">
<!-- fwtable fwsrc="bandeau.png" fwbase="bandeau.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
<tr>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="151" height="1" border="0" name="undefined_2"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="131" height="1" border="0" name="undefined_2"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="287" height="1" border="0" name="undefined_2"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="131" height="1" border="0" name="undefined_2"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="1" height="1" border="0" name="undefined_2"></td>
</tr>
<tr>
<td rowspan="4"><img name="bandeau_r1_c1" src="../Templates/bandeau_caf/bandeau_r1_c1.gif" width="151" height="95" border="0"></td>
<td colspan="3"><img name="bandeau_r1_c2" src="../Templates/bandeau_caf/bandeau_r1_c2.gif" width="549" height="6" border="0"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="1" height="6" border="0" name="undefined_2"></td>
</tr>
<tr>
<td rowspan="2"><img name="bandeau_r2_c2" src="../Templates/bandeau_caf/bandeau_r2_c2.gif" width="131" height="57" border="0"></td>
<td><img name="bandeau_r2_c3" src="../Templates/bandeau_caf/bandeau_r2_c3.gif" width="287" height="51" border="0"></td>
<td rowspan="2"><img name="bandeau_r2_c4" src="../Templates/bandeau_caf/bandeau_r2_c4.gif" width="131" height="57" border="0"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="1" height="51" border="0" name="undefined_2"></td>
</tr>
<tr>
<td><img name="bandeau_r3_c3" src="../Templates/bandeau_caf/bandeau_r3_c3.gif" width="287" height="6" border="0"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="1" height="6" border="0" name="undefined_2"></td>
</tr>
<tr>
<td colspan="3"><img name="bandeau_r4_c2" src="../Templates/bandeau_caf/bandeau_r4_c2.gif" width="549" height="32" border="0"></td>
<td><img src="../Templates/bandeau_caf/spacer.gif" width="1" height="32" border="0" name="undefined_2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="711" border="0" cellpadding="0" cellspacing="0" height="900">
<tr>
<td width="712" height="856" valign="top" bgcolor="#FFFFFF"><!-- #BeginEditable "principal" -->
<p> </p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" color="#000099" size="4"><b><img src="../images/p_orange30.gif" width="30" height="30" align="absmiddle">
Modification d'un enregistrement dans la base de donn&eacute;es (suite)</b></font></p>
<p align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000"><a href="<%=MM_Logout%>"><b>Quitter
sans faire de modifications</b></a></font></p>
<ul>
<li><b>Vous &ecirc;tes dans le module </b>: <b><font size="4" face="Verdana, Arial, Helvetica, sans-serif" color="#FF0000"><%= (((modules_data = modules.getObject("a_code_module_paf"))==null || modules.wasNull())?"":modules_data).toString().toUpperCase() %></font></b><br>
<br>
</li>
<li><b><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Effectuez
vos modifications dans les champs et cliquez sur "mettre &agrave;
jour l'enregistrement" :</font></b></li>
</ul>
<form name="maj" method="POST" action="<%=MM_editAction%>">
<p> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099"><br>
</font></b></p>
<table width="75%" border="0" cellspacing="0" cellpadding="3" bgcolor="#CCCCCC">
<tr>
<td>
<p><b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">Titre
dispositif :</font><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#FF0000">
</font></b> <br>
<input type="text" name="titre_dispositif" size="100" value="<%=((((modules_data = modules.getObject("titre_dispositif"))==null || modules.wasNull())?"":modules_data))%>">
</p>
<p> <b><font size="3" face="Verdana, Arial, Helvetica, sans-serif" color="#000099">Titre
module :<br>
</font> </b>
<input type="text" name="a_titre_module" size="100" value="<%=((((modules_data = modules.getObject("a_titre_module"))==null || modules.wasNull())?"":modules_data))%>">
</p>
<p> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">Public
</font> <font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">
:<br>
</font></b>
<textarea name="a_public" wrap="PHYSICAL" rows="3" cols="70"><%=(((modules_data = modules.getObject("a_public"))==null || modules.wasNull())?"":modules_data)%></textarea>
</p>
<p> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">Objectifs
</font> <font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">
:</font></b> <br>
<textarea name="a_objectif" cols="70" rows="5"><%=(((modules_data = modules.getObject("a_objectif"))==null || modules.wasNull())?"":modules_data)%></textarea>
</p>
<p> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">Contenus
: </font></b> <br>
<textarea name="a_contenu" cols="70" rows="5"><%=(((modules_data = modules.getObject("a_contenu"))==null || modules.wasNull())?"":modules_data)%></textarea>
</p>
<p> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">M&eacute;thode
:<br>
</font> </b>
<textarea name="a_methode" cols="70" rows="5"><%=(((modules_data = modules.getObject("a_methode"))==null || modules.wasNull())?"":modules_data)%></textarea>
</p>
<p> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">Lieu
:</font></b> <br>
<textarea name="lieu_stable" cols="70" rows="3"><%=(((modules_data = modules.getObject("lieu_stable"))==null || modules.wasNull())?"":modules_data)%></textarea>
</p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099"><b>Observations
:<br>
<textarea name="a_observation" cols="70" rows="3"><%=(((modules_data = modules.getObject("a_observation"))==null || modules.wasNull())?"":modules_data)%></textarea>
</b></font></p>
<p align="center">
<input type="submit" name="Submit" value="Mettre &agrave; jour l'enregistrement">
</p>
</td>
</tr>
</table>
<p><b><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#000099">
</font></b></p>
<input type="hidden" name="MM_update" value="true">
<input type="hidden" name="MM_recordId" value="<%=(((modules_data = modules.getObject("a_code_module_paf"))==null || modules.wasNull())?"":modules_data)%>">
</form>
<p align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000"><a href="<%=MM_Logout%>"><b>Quitter
sans faire de modifications</b></a></font></p>
<p> </p>
<!-- #EndEditable --></td>
<td width="1" height="856"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td valign="middle" bordercolor="#FF8516" colspan="2">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"
color=#999999><font size="2">� Formation des personnels- CRETEIL -
<!-- #BeginDate format:Sw1 -->14 mai, 2002<!-- #EndDate -->
</font></font></div>
</td>
</tr>
<tr>
<td height="2" width="712" bgcolor="#FFFFCC"></td>
<td width="1" height="2"></td>
</tr>
</table>
</body>
<!-- #EndTemplate --></html>
<%
modules.close();
Connmodules.close();
%>

If you replace all instances of your apostophe with a double apostrophe (not a quotation, but two apostrophe's), then that serves an escape sequence for most databases.

Similar Messages

  • Java server pages and java script

    sir i want to know that is it possible to call the functions define in the jsp tag
    <%
    %>
    in the java Script tag?
    how can i call jsp function in html

    There may be a way, but if so, it's very obscure.
    JSP functions are executed by the server prior to delivery of the web page to the web browser. Javascript functions are executed by the web browser on the web page. In order to get Javascript to call a JSP function, Javascript will literally have to request a new web page from the server (thus forcing the server to execute the JSP code).
    However, it is very easy to write functions in Javascript and it may be possible to do what you're trying to do without using JSP at all.

  • Java Server pages and STRUTS.

    HI all,
    i m displaying a list in the list box using html tag in the jsp page. the problem is if the size of the text is bigger than listbox it doesnot show the full text.
    is there is any other HTML:tag to make the full text visible.

    I agree with bsampieri.
    Keep in mind that it's actually fairly easy to edit a cookie as they are really just text files stored in a specific folder (directory) that your web browser knows about. So you generally want to keep information stored in a cookie to a minimum.
    For example, say we build a shopping site where you can buy widgets of all sorts. We decide to implement a shopping cart, that is, a list of all the things a customer intends to buy, the current price for each item (to reflect discounts), current shipping charges and so forth. If we stored that information in a cookie, someone could edit the cookie and change the prices.
    So usually a cookie simply contains some means of identifying the customer, and additional details, such as the shopping cart and the customer's billing information are all stored on the server and exposed to the customer only through secure interfaces.
    We also want to make sure that people can't arbituary change the values of their ids, so the id is usually encrypted into one very long string that looks like garbage.
    So you are right, it is kind of boneheaded that we can't store multiple values, but that's a result of the decision to go from needed-functionality to code, rather than coding all of the possible situations and picking the desired functionality out of it. Fortunately there are other options. :)

  • New in java server pages and j2ee

    hello, im new in jsp and servlet..im new in j2ee..
    my OS is Windows XP ..
    i dont know how to start learning...
    i installed J2EE development kit.. also.. i start the server from (Start Default Server)
    i dont know how to create jsp files. and java files..
    where to write the java code and where to write html code..
    also.. where should i save these files.. i mean.. in which directory?
    i want to know how can i start the servlet and JSP.. someone told me.. to put http://localhost:8080.. when i put this in the browser.. it works correctly..
    can anybody help me????

    http://java.sun.com/learning/training/index.html

  • Java Server Pages and Cookies

    I've been looking through several examples on the Web and I feel like I am missing something here.
    Most examples use a similar setting:
    ... loop through cookies looking for the right one and then...
    temp = cookie.getValue();
    out.println(temp);
    Which I guess is fine if you have a single value in the cookie like all the examples. But what if you have several? How do you know which is being got - especially if in several sections of the site you set things in the cookie so they might not always be in the same order?
    Is there was someway of looping through the cookie values for a specific one or am I expected just to hope I get the right one?
    Graham Reeds.

    I agree with bsampieri.
    Keep in mind that it's actually fairly easy to edit a cookie as they are really just text files stored in a specific folder (directory) that your web browser knows about. So you generally want to keep information stored in a cookie to a minimum.
    For example, say we build a shopping site where you can buy widgets of all sorts. We decide to implement a shopping cart, that is, a list of all the things a customer intends to buy, the current price for each item (to reflect discounts), current shipping charges and so forth. If we stored that information in a cookie, someone could edit the cookie and change the prices.
    So usually a cookie simply contains some means of identifying the customer, and additional details, such as the shopping cart and the customer's billing information are all stored on the server and exposed to the customer only through secure interfaces.
    We also want to make sure that people can't arbituary change the values of their ids, so the id is usually encrypted into one very long string that looks like garbage.
    So you are right, it is kind of boneheaded that we can't store multiple values, but that's a result of the decision to go from needed-functionality to code, rather than coding all of the possible situations and picking the desired functionality out of it. Fortunately there are other options. :)

  • Integration of PL/SQL and JSP (Java Server Pages)

    I need to match a web application developed with PL/SQL with another developed in JSP (Java Server Pages) the problem is that the two apps interact with the same databese, an share de same users, I need to know how to get the user and password loged into pl/sql when the user want to use same of de .jsp pages running on another application server?

    Hi Michael Vstling,
    Did you try the java classes library (SDOAPI) that can be downloaded from OTN?
    It may provide you with a better alternative when manipulating geometries in the Java space. There is an adapter in SDOAPI which can convert a JDBC STRUCT object into Java Geometry object defined in SDOAPI, and vice versa.
    There are at least two ways in mixing PL/SQL and Java. The first one, as you mentioned, is to define your custom function in terms of PL/SQL and call it from within your Java program. With SDOAPI, you have the second option, which is to define your own functions in Java using SDOAPI and deploy them as Java stored procedures in db. You can then call them from within your PL/SQL code. In either way performance depends on a lot of things and generally it requires a "try and improve" approach.
    About JPublisher and sdo_ordinate_array it may not be a spatial related problem. Did you try search the Java-related forums first?
    LJ

  • DBMS_OUTPUT.PUT_LINE multi records from PL/SQL procedure to Java web page.

    Hello
    I will explain the scenario:
    In our java web page, we are using three text boxes to enter "Part number,Description and Aircraft type". Every time the user no need to enter all these data. The person can enter any combination of data or only one text box. Actually the output data corresponding to this input entries is from five Oracle table. If we are using a single query to take data from all the five tables, the database will hang. So I written a procedure "SEARCH1",this will accept any combination of values (for empty values we need to pass NULL to this procedure) and output data from all the five tables. When I executing this procedure in SQL editor, the execution is very fast and giving exact result. I used "dbms_output.put_line" clause for outputing multiple records in my procedure. The output variables are "Serial No, part Number, Description, Aircraft type,Part No1,Part No2,Part No3,Part No4". I want to use the same procedure "SEARCH1" for outputing data in java web page.The passing argument I can take from the text box provided in java web page. I am using jdbc thin driver to connect our java web page to Oracle 9i database.
    Note1 : If any combination of search item not available, in procedure itself I am outputing a message like "Part Number not found". Here I am using four words ("Part" is the first word,"Number" is the second,"Not" s the third, and "found" is the fourth) for outputing this message.Is it necessary to equalise number of words I am using here to the record outputing eight variable?
    Our current development work is stopped because of this issue. So any one familier in this field,plese help me to solve our issue by giving the sample code for the same scenario.
    My Email-id is : [email protected]
    I will expect yor early mail.
    With thanks
    Pramod kumar.

    Hello Avi,
    I am trying to solve this issue by using objects. But the following part of code also throwing some warning like "PLS-00302: component must be declared". Plese cross check my code and help me to solve this issue.
    drop type rectab;
    create or replace type rectype as object(PartNo varchar2(30),Description varchar2(150),AIrcraft_type varchar2(15),status_IPC varchar2(30),status_ELOG varchar2(30),status_SUPCAT varchar2(30),status_AIRODWH varchar2(30));
    create or replace type rectab as table of rectype;
    create or replace package ioStructArray as
    procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab);
    end ioStructArray;
    create or replace package body ioStructArray as
    procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab) is
    mdescription varchar2(150);
    mpartnum varchar2(30);
    mpno varchar2(30);
    mdes varchar2(150);
    mair varchar2(15);
    mstat varchar2(1);
    cursor c1 is select partnum,description,aircraft_type from master_catalog where partnum=mpno and aircraft_type=mair and description like ltrim(rtrim(mdes))||'%';
    cursor c2 is select partnum from ipc_master where partnum=mpartnum;
    cursor c3 is select partnum from fedlog_data where partnum=mpartnum;
    cursor c4 is select partnum from superparts where partnum=mpartnum;
    cursor c5 is select part_no from supplier_catalog where part_no=mpartnum;
    mpno1 varchar2(30);
    mpno2 varchar2(30);
    mpno3 varchar2(30);
    mpno4 varchar2(30);
    mpno5 varchar2(30);
    maircraft_type varchar2(15);
    mstat1 varchar2(30);
    mstat2 varchar2(30);
    mstat3 varchar2(30);
    mstat4 varchar2(30);
    begin
    mstat:='N';
    mpno:=pno;
    mdes:=pdes;
    mair:=air;
    if mpno is not null and mdes is not null and mair is not null then
    begin
    mstat:='N';
    mpno:=pno;
    mdes:=pdes;
    mair:=air;
    for i in c1 loop
    mstat:='N';
    mstat1:='N';
    mstat2:='N';
    mstat3:='N';
    mstat4:='N';
    mpno1:=i.partnum;
    mpartnum:=i.partnum;
    mdescription:=i.description;
    maircraft_type:=i.aircraft_type;
    for j in c2 loop
    mpno2:=j.partnum;
    end loop;
    for k in c3 loop
    mpno3:=k.partnum;
    end loop;
    for l in c4 loop
    mpno4:=l.partnum;
    end loop;
    for m in c5 loop
    mpno5:=m.part_no;
    end loop;
    if mpno2=mpartnum then
    mstat1:=mpno2;
    end if;
    if mpno3=mpartnum then
    mstat2:=mpno3;
    end if;
    if mpno4=mpartnum then
    mstat3:=mpno4;
    end if;
    if mpno5=mpartnum then
    mstat4:=mpno5;
    end if;
    if mpno1=mpartnum then
    mstat:='Y';
    orec.PartNo:=mpno1;
    orec.Description:=mdescription;
    orec.AIrcraft_type:=maircraft_type;
    orec.status_IPC:=mstat1;
    orec.status_ELOG:=mstat2;
    orec.status_SUPCAT:=mstat3;
    orec.STATUS_AIRODWH:=status_AIRODWH;
    end if;
    end loop;
    end;
    end if;
    end testsch2;
    end ioStructArray;
    Expecting your early reply.
    With thanks
    Pramod kumar.

  • Java.util.Date and java.sql.Date

    when i am trying to displaying date in my jsp page errors occurs saying that java.util.date and java.sql.date are matching..
    i have some sql statements which i need to execute in the page.so i cant delete that import sql statement.
    so what is the solution for this.
    i want to display the date as 19th april 2003....in the jsp page.
    thank u

    You should use full names.
    java.util.Date date;
    java.sql.Date sdate;
    ..And it may be a good idea to delete one of the two "import" declaration of packages.

  • Help converting between Java Dates and SQL Dates

    Hey all,
    I'm working on a JSP to allow a user to enter information about news articles into a mySQL database. I'm using text fields for most of the data, and most of it is transferred correctly when the user hits "Submit." However, I am having a problem with the date field of the mySQL database. Basically I'm trying to retrieve the current date from the JSP page, and then insert this into the date field of the appropriate table when the user hits submit. The problem is that I can't typecast a java.util.Date or even a java.util.Calendar to a java.sql.Date object. I've tried lots of approaches, including creating a new instance of java.util.Calendar, getting all its fields and concatenating them onto the date variable, but this doesn't work.
    Anyone know how I could easily convert between java.util.Date or java.util.Calendar and java.sql.Date?
    Thanks!

    Thanks for the help!
    I can correctly display the current date on the page in java.sql.Date format now, but it's still not being inserted into the database correctly. The specific code is as follows:
    java.util.Date dt = new java.util.Date();
    java.sql.Date sqlDate = new java.sql.Date(dt.getTime());
    (As you wrote)
    Then (after connecting to the database etc.):
    PreparedStatement pstmt = con.prepareStatement("INSERT INTO NEWS(NEWSDATE,DAYOFWEEK,AUTHOR,HEADLINE,CLIP,PUBLICATION,LINK,NEWSLOCATION,DATECREATED,DATEMODIFIED,CATEGORY,KEYWORDS,PHOTOURL,PHOTOGRAPHER,AUDIOURL) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
    pstmt.clearParameters();
    pstmt.setString(1,date);
    pstmt.setString(2,dayofweek);
    pstmt.setString(3,author);
    pstmt.setString(4,headline);
    pstmt.setString(5,clip);
    pstmt.setString(6,publication);
    pstmt.setString(7,link);
    pstmt.setString(8,newslocation);
    pstmt.setDate(9,sqlDate);
    pstmt.setString(10,datemodified);
    pstmt.setString(11,category);
    pstmt.setString(12,keywords);
    pstmt.setString(13,photoURL);
    pstmt.setString(14,photographer);
    pstmt.setString(15,audioURL);
    int i = pstmt.executeUpdate();
    pstmt.close();
    All the other fields are retrieved with request.getParameter from text fields. Any idea why the DATECREATED field is being updated to all 0's but the others work fine?
    Thanks again.

  • FMT and SQL tablibs not recognised in JSF2 xhtml page

    The following xhtml page produces the html source shown below. However I can't get it to process the fmt and sql taglibs correctly. I had this working prior to using xhtml pages. I had a look a the J6EE tutorial (Chapter 6 - Facelets) which mentions all the other tab libraries, but not those two. What are the available alternatives ?
    other.xhtml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
          xmlns:sql="http://java.sun.com/jsp/jstl/sql"
          xmlns:fn="http://java.sun.com/jsp/jstl/functions"
          xml:lang="en" lang="en">
    <fmt:setBundle basename="com.j2anywhere.addressbookserver.web.Translations" var="translations" scope="session"/>
    <f:loadBundle basename="com.j2anywhere.addressbookserver.web.Translations" var="faces_translations"/>
    <h:head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <c:if test="${pageContext.request.requestURI ne '${pageContext.request.contextPath}/autoLogout.jsf'}">
      <meta http-equiv="refresh" content="1800;url=${pageContext.request.contextPath}/autoLogout.jsf"/>
      </c:if>
      <title><fmt:message key="PageTitle" bundle="${translations}"/></title>
      <script src="${pageContext.request.contextPath}/scripts/common.js" type="text/javascript"></script>
    </h:head>
    <h:body>
      <h1>Other</h1>
      <h:form>
        <h:outputText value="#{faces_translations.Yes}"/>
      </h:form>
      <h:outputText value="#{faces_translations.Yes}"/>
    </h:body>
    </html>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:sql="http://java.sun.com/jsp/jstl/sql" xml:lang="en" lang="en">
    <fmt:setBundle basename="com.j2anywhere.addressbookserver.web.Translations" var="translations" scope="session"></fmt:setBundle>
    <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
      <meta http-equiv="refresh" content="1800;url=/autoLogout.jsf" />
      <title><fmt:message key="PageTitle"></fmt:message></title>
      <script src="/scripts/common.js" type="text/javascript"></script></head><body>
      <h1>Other</h1>
    <form id="j_idt10" name="j_idt10" method="post" action="/other.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="j_idt10" value="j_idt10" />
    Yes<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-9208139216578266380:-4314993053830858838" autocomplete="off" />
    </form>Yes</body>
    </html>

    okay here's the code for the whole procedure. Some variable names have been changed but it's otherwise the same code:
    DECLARE
    v_total_cost     NUMBER(10,2);
    v_deposit        NUMBER(10,2);
    v_remaining      NUMBER(10,2);
    v_payment_type   varchar2(2);
    v_checkbox       varchar2(4000);
    v_user           varchar2(4000);
    v_bok_paid       varchar2(1);
    v_msg            varchar2(4000);
    BEGIN
    v_total_cost     := :P100_COST;
    v_deposit        := :P100_DEPOSIT;
    v_remaining      := v_total_cost - v_deposit;
    v_payment_type   := :P100_PAYMENT_AMOUNT;
    v_checkbox       := :P100_CHECKBOX;
    v_user           := :APP_USER;
    --wwv_flow.debug('before condition');
    if v_checkbox != '' AND :P100_RADIO = 'CD' THEN
      v_bok_paid := 'Y';
    else
      v_bok_paid := 'N';
    end if;
    --wwv_flow.debug('after condition');
    IF v_payment_type  = 'D' THEN
    :P100_AMOUNT_TO_PAY := :P100_DEPOSIT;
    INSERT INTO SAL_TRANSACTIONS (TRA_BKG_ID, TRA_COST, TRA_TOTAL,TRA_TYPE, TRA_PAID, TRA_PAY_TYPE, TRA_DATE, TRA_MANUAL, TRA_USER)
    VALUES (:P100_BKG_ID, 0, v_deposit, v_payment_type, v_bok_paid, :P100_RADIO, SYSDATE, v_checkbox, v_user);
    INSERT INTO SAL_TRANSACTIONS (TRA_BKG_ID, TRA_COST, TRA_TOTAL,TRA_TYPE, TRA_PAID, TRA_PAY_TYPE, TRA_DATE, TRA_MANUAL, TRA_USER)
    VALUES (:P100_BKG_ID, 0, v_remaining, 'L','N', null, SYSDATE, v_checkbox, v_user);  
    ELSIF v_payment_type  = 'F' THEN
    :P100_AMOUNT_TO_PAY := :P100_COST;
    INSERT INTO SAL_TRANSACTIONS (TRA_BKG_ID, TRA_COST, TRA_TOTAL,TRA_TYPE, TRA_PAID, TRA_PAY_TYPE, TRA_DATE, TRA_MANUAL, TRA_USER)
    VALUES (:P100_BKG_ID, 0, v_total_cost, :P100_PAYMENT_AMOUNT, v_bok_paid, :P100_RADIO, SYSDATE, v_checkbox, v_user);
    END IF;
    :P100_TRANSACTION_FLAG := '1';
    if v_bok_paid = 'Y' then
    v_msg := '<div>Message clipped</div>';
    --send confirmation email
    GLO_CORRESPONDANCE.proc_corr_controller(
    :P100_BOOKING_MEMBER_ID,
    :P100_BKG_ID,
    null,
    v_msg,
    'E',
    'Payment confirmation',
    null
    end if;
    END;Thanks :)

  • Problems with java and SQL

    Hi all. Not sure if I should ask this here or in an SQL forum. I�m trying to manipulate an access database through java via the JDBC-ODBC bridge driver. The program compiles ok but when I try to execute it I get an error. According to the error there is a syntax problem in my SQL create table statement but it doesn�t tell what the problem is and I�ve looked over the create statement and can�t find anything wrong with it. There is, however, an error code from the driver but I have no way of referencing it. Anyone here know why otherwise normal SQL code would cause a syntax error with java or how I can track the error to get a hint at what�s going wrong? Here is the code and the error:
    // java program to create an access database through JDBC
    import java.sql.*;
    public class videodb {
    public static void main(String args[]) {
         // attempt tp load DB driver
         try {
         // load the jdbc-odbc driver
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         catch (ClassNotFoundException cnfe) // driver not found
         System.err.println("Unable to load database driver");
         System.err.println("Details : " + cnfe);
         System.exit(0);
         try {
         // Create a connection to the data source
              Connection con = DriverManager.getConnection ("jdbc:odbc:vdds","","");
              // Create a statement to execute SQL commands     
              Statement stmt = con.createStatement();
              // create a table for DVD's
              stmt.executeUpdate ("create table DVD (id number(5), name char(30));");
              // insert a record into the DVD table
              //stmt.executeUpdate ("insert into DVD values (0001, 'StarGate');");
              // Close the connection
         con.close();
         catch (SQLException sqle) {
    System.out.println("Problem with SQL: " + sqle);
    System.out.println("Driver Error Number" + sqle.getErrorCode());     
    Error:
    Problem with SQL: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in CREATE TABLE statement.
    Driver Error Number-3551

    Here's what I got. I don't see anything that helps but I'm kinda new to using SQL and java together.
    D:\javatemp\viddb>java videodb
    Problem with SQL java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver
    ] Syntax error in CREATE TABLE statement.
    Driver Error Number-3551
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in
    CREATE TABLE statement.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    at videodb.main(videodb.java:31)
    D:\javatemp\viddb>

  • SQL query with Java Server Pages

    Hey,
    I'm trying to read some information from database with SQL Query. How I can put the parameter that I get from previous *.jsp page to SQL query?
    Technologies that I use are WML, JSP and MySQL.
    I can get the parameter by method getParameter() and it is correct.
    But how to but the requested parameter into sql query and complete the sql query?
    Should I read it to some variable before putting it to sql query?
    */ this works fine */
    out.println("<p>periodi"+request.getParameter("periodi"+"loppu</p>");
    /* this doesn't work */
    ResultSet tulokset = lause.executeQuery("select * from kurssi where periodi='+request.getParameter("periodi")+'");
    /* this doesn't work */
    String periodi=request.getParameter("periodi");
    ResultSet tulokset = lause.executeQuery("select * from kurssi where periodi='periodi' '");
    Thanks,
    Rampe

    Hey,
    I'm trying to read some information from database
    se with SQL Query. How I can put the parameter that I
    get from previous *.jsp page to SQL query?
    Technologies that I use are WML, JSP and MySQL.
    I can get the parameter by method getParameter()
    () and it is correct.
    But how to but the requested parameter into sql
    ql query and complete the sql query?
    Should I read it to some variable before putting it
    it to sql query?
    */ this works fine */
    out.println("<p>periodi"+request.getParameter("periodi"
    "loppu</p>");
    /* this doesn't work */
    ResultSet tulokset = lause.executeQuery("select * from
    kurssi where
    periodi='+request.getParameter("periodi")+'");
    /* this doesn't work */
    String periodi=request.getParameter("periodi");
    ResultSet tulokset = lause.executeQuery("select *
    * from kurssi where periodi='periodi' '");
    Thanks,
    RampeTry this
    ResultSet tulokset = lause.executeQuery("select * from kurssi where periodi=" + "'" +request.getParameter("periodi")+"' " );this should work

  • Can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market

    can someone pls help me with java on my macbook pro because after i download the mountain lion java has died and i need java to see streaming quotes from stock market

    Java is no longer included in Mac OS X by default. If you want Java, you will have to install it.
    However, note that you should think twice before installing Java for such a trivial need as looking at stock market quotes. There are other ways to get that information that don't involve Java, and using Java in your web browser is a HUGE security risk right now. Java has been vulnerable to attack almost constantly for the last year, and has become a very popular, frequently used method for getting malware installed via "drive-by downloads." You really, truly don't want to be using it. See:
    Java is vulnerable… Again?!
    http://java-0day.com

  • Code to set and destroy session variables in Java Server Pages(JSP)

    code to set and destroy session variables in Java Server Pages(JSP)
    we have use following statement to set session variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session variable
    session.setAttribute("userClient","");
    and
    the session.invalidate() is not working
    Plz. solve this probem

    code to set and destroy session variables in Java
    Server Pages(JSP)
    we have use following statement to set session
    variable
    session.setAttribute("userClient",id);
    we have use following statement to destroy session
    variable
    session.setAttribute("userClient","");Perhaps if you tried using
    session.setAttribute("userClient", null);
    or
    session.removeAttribute("userClient");
    and
    the session.invalidate() is not workingNot working how?
    >
    Plz. solve this probem

  • Java for PI 7.1 EHP1 in Windows and SQL Server 2008

    Hi Gurus
    I try to install PI 7.1 EHP1 in Windows and SQL Server 2008. The questions is :
    What version of java is the correct for this installation???
    And where i can download it??
    Thanks and advance!!!

    Hi Aaron,
    The version for PI 7.1 is 1.5, instead of the 1.4.2 of 7.0/3.0.
    Anyway, for VM settings, you should refer to SAP JVM, which
    is used for the PI 7.11.
    Hope it helps!
    Regards,
    Caio Cagnani

Maybe you are looking for

  • Ak query condition

    Hi all, How we can query the following conditions using ak query. there is 2 variable say A and B if A&B is present then condition must be where A=value of A and B=value of B this condition works when given qo0 and qo1 value as IN but other condition

  • How to run my vi from a front panel control without using even structure in the vi

    Hello, I would like to run my vi from a front pannel control instead of the tool bar RUN botton. I am using LV6.1 without the even structure feature, so I can't do as proposed by a previous posting by setting the vi to run at open in a "do nothing st

  • Pass List of

    Good Morning, I need to break up a list of about 45,000 IDs to pass about 5,000 at a time into a query on DB2 via an Expression on a Data Flow Task.   The query works when hard coding the values into the query (see A below).  I can also pass a single

  • I keep getting 'unknown error' after clicking 'install app' when trying to download Mavericks from the App store.

    Trying to install Mavericks from the App store on my 2011 11" Macbook air, (wihch has more than 15GB free space).  After clicking 'Install App', and entering the Apple ID password, I get 'unkonwn error'.

  • Cannot access external hard disk

    I keep all my data in Segate external hard disk. Today I wanted to set up windows using Boot camp. The window installed but at the end it froze. By mistake I kept the External hard disk connected to my Macbook Pro. When I rebooted I cannot find the m