Error - '.' expected - while database insert thru JSP & javabeans & JDBC
I get the following error when i try to compile the below mentioned code in JDEVELOPER 10.1.2
Error : '.' expected
===================
have error in my code. I am trying to do a simple database insert program using javabeans and jsp. I get a value to be inserted in database through the jsp page in a text box and would like to be inserted into database using beans The connection to database and mysql query are in java file.
Here is the code.
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page language="Java" import="java.sql.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<html>
<head>
</head>
<body>
<form name="form1" action="beancode" method="POST">
Emp ID: <input type="text" name ="emplid"> <br><br><br>
<input type = "submit" value="Submit">
<jsp:useBean id="sampl" class="beancode" scope="page">
<jsp:setProperty name="sampl" property="*"/>
</jsp:useBean>
</form>
</body>
</html>
I know i might have made a mistake here in using the bean. Here is the java code which does the insert part.
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
* @author Trainees
public class beancode
private String employid;
private Connection con = null;
private ResultSet rs = null;
private PreparedStatement st = null;
/** Creates a new instance of beancode */
public beancode()
try
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sample?user=user&password=password");
catch(Exception e)
System.out.println(e.getMessage());
public void setemployid(String empid)
employid = empid;
public String getemployid()
return (employid);
public void insert()
try
String s1="insert into samp values('"+employid+"')";
st = con.prepareStatement(s1);
st.executeUpdate();
st.clearParameters();
st.close();
catch(Exception m)
}
It's pretty hard to spot any errors the way it's currently formatted. But, you're trying to call the beancode when submitting your form, but the beancode isn't a servlet. Try to find a working example, run it, and then change it to implement your requirements.
The following example shows you have to use the jstl sql tags: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jstlsql.html. If you want to do an insert when a user submits a form, you need 2 pages. The first will contain your form, the second will insert the record.
(once you've got that running, look for some examples using an mvc framework, and how to use bind variables with jdbc)
Similar Messages
-
Want to save time while doing inserts or updates using JDBC
I want to save time while doing inserts/updates in a database in my Java app. using JDBC. My app. has to do a lot of inserts and that takes up a lot of time.
I can do some buffering and then do bulk/batch inserts if that will help. any pointers on whether this will be useful and how to go about it?
Is there any other way I can save time and thereby improve performance?
I am using Oracle 8 with Oracle thin driver.
ThanksI tried using the PreparedStatement.addBatch() and PreparedStatement.executeBatch() in a test program.
The error is SQLException - "Unsupported feature" which I get at the addBatch method call. I am using oracle thin driver sdk 8.1.6 for jdk 1.2.x
What is wrong here?
Thanks -
Getting 'unidentified error occured' while database connecting on local computer
I have downloaded CS5 Dreamweaver trial version on my c
omputer, with windows 7.
I have also downloaded easy php as php-mysql-apache server on the same computer.
While creating a databse connection, I get following message
'Undefined error ocurred'.
and the connection does not take place.
If I close the connection wizard, with giving database name, connection is shown on the applications pane, but when tables icon is clicked, no tables are show.
Also when I try to create a recordset, it shows that there are no tables in the databse.
I have insertd screen shots of the connection wizard.
Kindly help.I'm not familiar with EasyPHP, but it should work the same as any other local testing environment.
In the Servers panel, deselect the Remote checkbox. Leave only the Testing checkbox selected.
Something unusual about the Local Info panel is that the Web URL, although grayed out, is accessing http://127.0.0.1:8888. Localhost is an alias for 127.0.0.1, so that's not a problem, but the colon followed by 8888 is a non-standard port. Does EasyPHP run Apache on port 8888? If so, you need to change the Web URL in the Server Basic panel to http://localhost:8888/InventaEnqFrm/.
Also, if Apache is running on port 8888, it's very likely that MySQL is running on port 8889, so you would need to use localhost:8889 in the MySQL Connection dialog box.
The other obvious thing to check is that both Apache and MySQL are running.
By the way, it's normal practice to put the local files in the same location as the testing server. -
Getting error msg while inserting a record
HI
Am getting error msg while am inserting a new record. Am unable to view the data that i inserted in to database. If any one can help in sorting of the problem plz help. I used the following code in Application Module(AM) and Controller(CO)
processRequest()
-- am.invokeMethod("insertmethod");
processFormRequest()
-- if(pageContext.getParameter("Create")!=null)
-- am.invokeMethod("savemethod");
In AM Code
public void insertmethod()
EOVOImpl vo=getEOVO1();
if(!vo.isPreparedForExecution())
{ vo.executeQuery(); }
Row ro=vo.createRow();
vo.insertRow(ro);
ro.setNewRowState(Row.STATUS_INITIALIZED);
public void savemethod()
{ OADBTransaction oa=getOADBTransaction();
oa.commit(); }
Error
Attribute SummaryFlag in kiInsertAM.kiInsertEOVO1 is requiredHi,
Either on the form you don't have SummaryFlag field or you forgot to map VO attribute i.e. SummaryFlag to that field.
If you don't have SummaryFlag field on form then you need to set it programatically before committing record.
Please check and let us know.
Regards,
Mukesh Uchaniya -
Error occurred while parsing: Start of root element expected.
This my code i use to try inserting xml data:
v_BFile := BFILENAME('XML_DIR',v_xmlfile);
DBMS_LOB.createTemporary(v_clob, cache=>false);
DBMS_LOB.open(v_bFile, DBMS_LOB.lob_readonly);
DBMS_LOB.loadFromFile(v_clob,v_BFile,DBMS_LOB.getLength(v_bfile));
DBMS_LOB.close(v_bfile);
v_parser := XMLPARSER.newParser;
XMLPARSER.parseClob(v_parser,v_clob);
On the parseClob is get the error message: Error occurred while parsing: Start of root element expected.
My xml is as follows
<?xml version="1.0" ?>
<EMPLOYEES>
<EMP>
<EMPNO>8000</EMPNO>
<ENAME>JONES</ENAME>
<JOB>DBA</JOB>
<MGR>7839</MGR>
<HIREDATE>07-MAY-2002</HIREDATE>
<SAL>100</SAL>
<COMM>10</COMM>
<DEPTNO>10</DEPTNO>
</EMP>
<EMP>
<EMPNO>8001</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>PROG</JOB>
<MGR />
<HIREDATE>01-MAY-2002</HIREDATE>
<SAL>200</SAL>
<COMM>10</COMM>
<DEPTNO>10</DEPTNO>
</EMP>
</EMPLOYEES>
What do i do wrong. Can someone help meKurt
Can you answer the following questions
Which Release of the database are you using ?
What is the database character set ?
What is the character set encoding of the source document ?
Remember that the loadFromFile procedure is designed to load binary data, and does not convert data into the database character set. If the database character set is UTF8, then the CLOB data has to be UCS2.
Can you dump the contents of the CLOB
If you are using 9iR2 then you can use the new procedure GetCLOBFromFile which will perform the correct coversions.
Also in 9iR2 we would recommend the use of the DBMS_XMLPARSER package, rather than the XMLPARSER package. The reason for this is the DBMS_XMLPARSER makes use of a 'C' based parser, running as native compiled code, which XMLPARSER still uses the Java based version of the parser. Performance with DBMS_XMLPARSER is much better.
Hope this helps -
Error message while creating database
Log error
while creating new database
Robot-properties
XML Parsing Error: junk after document element
Location: http://portalserver/psconsole/faces/search/RobotPropertiesHome.jsp
Line Number 18, Column 1:<body id="_id3" onload="return _id3_jsObject
I have created my new search engine .
and the robot is not running.I getting log error.
and no directory is created with the search name.
please help me with the fields..
creating search server..
required Port:
required Configuration Name:
Required Instance:
*Web Container Administration*
Required Administration Host:
Required Administration Port:
Required Administrator:
Required Administration Password:
*Web Container Directories*
Required Install Directory:
Required Instance Directory:
Required Document Root Directory:Kriti Sundar Mazumder wrote:
Hi
I am getting an following error message, while creating database connection pool
in weblogic 7.
"<Jun 18, 2004 4:52:36 AM CDT> <Error> <JDBC> <001060> <Cannot startup connection
pool "MyJDBCConnectionPool" java.sql.SQLException: [IBM][JDBC Driver] CLI0647E
Error allocating DB2 environment handle, rc=-1.>"
Can anyone help me out in this regard
Regards
KritiHi. I am no expert, but it sounds like a problem with the privileges the user
has... The best thing is to step back to a simpler environment. Can you try
connecting to DB2 with a simple program like utils.dbping? Please look at our
driver docs for the DB2 driver, because there are several variations in connect
properties depending on the type of DB2 you are connecting to...
Joe -
Errors in the OLAP storage engine: An error occurred while processing the indexes for the partition of the measure group of the cube from the database.
I have dropped and recreated a fact table to refresh the data as the table is having identity columns. So not able to directly insert data. After that cube is throwing above error.
Please suggest.Hi Md,
It hard to analyse the issue base on the limited information, Are there any error message on the log? Under C:\Program Files\Microsoft SQL Server\MSAS11.\OLAP\Log (this could be different for your server), there are 3 log files that are generated:
msmdrrv.log
FlightRecorderCurrent.trc
FightRecorderBack.trc
The msmdrrv.log simply points to the other two logs. There might be some detail information for this error. Please provide us the detail information about it, so that we can make further analysis.
Regards,
Charlie Liao
TechNet Community Support -
An error occurred while attempting to update the database
Hi
the update from 2.82 to 2.9.0 fails for me with following message
An error occurred while attempting to update the database.
the update log ends like this
[Microsoft][ODBC SQL Server Driver][SQL Server]DELETE failed because the
following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify
that SET options are correct for use with indexed views and/or indexes on
computed columns and/or filtered indexes and/or query notifications and/or XML
data type methods and/or spatial index operations.
1> 2> 3> [16:56:20] RunShellCommand: Command: osql exited with code: 1
[16:56:20] RunShellCommand: Exit code indicates failure.
[16:56:20] UpdateDatabase: Failed to run database update script.
hope that anyone can solv this for meIt seems that my problem is with one of ldapservers.
When the periodic update runs.
then there will be error periodic update failed
log file mdm_error looks like this
[00:01:46] Failed running query:
IF NOT EXISTS(SELECT LDAPContainerName FROM LDAPContainers WHERE LDAPContainerName=? AND LDAPServerSAKey = ?)
BEGIN INSERT INTO LDAPContainers(LDAPContainerName, DisplayName, LDAPContainerType, ParentContainerSAKey,
LDAPServerSAKey, LDAPMemberType, AllowHandsOffEnrollment) VALUES (?,?, 2,
(SELECT LDAPContainerSAKey FROM LDAPContainers WHERE LDAPContainerName =? AND LDAPServerSAKey =?) , ?, 1, 1) END
SQLError:
I think this is the reason that the upgrade fails.
How can i solve this? -
Using HTML, JSP, JavaBeans and Access database
I'm trying to create a login page that will allow users to query, insert, modify, and delete information. I have an HTML page that the user chooses which option they want to do. I have 4 JSP's set up for each option. My biggest issue is getting them to talk to the database using a single JavaBean. I can create several beans to pull the information, post, delete, or modify. I'm having trouble pulling information through the JSP's from the HTML page. Please help...
Hey,
You get html to communicate with your server using forms. Use the request to retrieve the submitted form data. All you would need to do is tell your bean what it is doing, how and with what.
Good luck -
Error due to accessing database connection using jsp
Hi,
I have an error, during accessing a datbase using jsp:useBean from jsp.Urgent i need this one
my source code is
DbBean.java
package SQLBean;
import java.sql.*;
import java.io.*;
public class DbBean implements java.io.Serializable{
private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private Connection dbCon;
public DbBean(){
super();
public boolean connect() throws ClassNotFoundException,SQLException{
Class.forName(dbDriver);
dbCon = DriverManager.getConnection("jdbc dbc:mybean","","");
return true;
public void close() throws SQLException{
dbCon.close();
public ResultSet execSQL(String sql) throws SQLException{
Statement s = dbCon.createStatement();
ResultSet r = s.executeQuery(sql);
return (r == null) ? null : r;
public int updateSQL(String sql) throws SQLException{
Statement s = dbCon.createStatement();
int r = s.executeUpdate(sql);
return (r == 0) ? 0 : r;
database.jsp
<HTML>
<HEAD><TITLE>DataBase Search</TITLE></HEAD>
<BODY>
<%@ page language="Java" import="java.sql.*" %>
<jsp:useBean id="db" scope="application" class="SQLBean.DbBean" />
<jsp:setProperty name="db" property="*" />
<center>
<h2> Results from </h2>
<hr>
<br><br>
<table>
<%
db.connect();
ResultSet rs = db.execSQL("select * from employ");
int i = db.updateSQL("UPDATE employ set fname = 'hello world' where empno='000010'");
out.println(i);
%>
<%
while(rs.next()) {
%>
<%= rs.getString("empno") %>
<BR>
<%
%>
<BR>
<%
db.close();
%>
Done
</table>
</body>
</HTML>
The error like this
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\muthu\WEB-INF\classes\SQLBean\DbBean.class. The major.minor version '49.0' is too recent for this tool to understand.
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:65: Class SQLBean.DbBean not found.
SQLBean.DbBean db = null;
^
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:68: Class SQLBean.DbBean not found.
db= (SQLBean.DbBean)
^
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:73: Class SQLBean.DbBean not found.
db = (SQLBean.DbBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SQLBean.DbBean");
^
4 errors, 1 warning
Anybody help me?
Thanx in advanceYour code is ok . The problem is in java version witch you use to compile the DbBean class . I think you are using java 1.5 try to change to 1.4 compile and run again should help .
-
Hi,
Me and a collegue is administrering our new enterprise BI portal in SharePoint 2013 (On Premise) and have a problem with using a specific Excel file including general ledger data as data source through a BISM file.
This particular BISM file can't be saved without getting the error message "There were errors found while validating the page: Cannot connect to the server or database."
BISM files against other Excel sheets and sources (for example SSAS tabular databases) works well.
Can anyone help us pinpointing whats wrong here, this is a really important stakeholder in our organization requesting this reporting?
Cheers!Hi E.SWARD ,
My self created a Power pivot excel then i want to use this excel to create BI file . Still i am getting the same error . Pls help me to resolve this issue
Cannot connect to the server or database.
I am getting the similar error , if i use Tabular analysis server instance .
Subhash -
Loading issue : Error: sql error in the database while accessing a table
Hello,
where as one of the DTP in the process chain failed due to *Error: sql error in the database while accessing a table*, where as in the short dump it showing as Transaction log of data base is full., but i checked the data base space in DB02, more space is available . once we run the same DTP by manually its successful. its not through any errors.
could u please help me out solve the problem.
Thanks
siva kumar.it might be a lock. do you drop index before loading?
the database might be full at the moment of loading and not later if many loadings happen at the same time on the same system...
when you then rerun your dtp manually, it can go through as it's perhaps the only one running at that moment...
you can try to set the btch parameter to 1...this will help in some cases.
M. -
Error message while starting database
Hi all,
I am getting the following error message while starting the database . I just modified the DB_CACHE_SIZE parameter from 781MB to 781(+500MB) .We are using Oracle 9.2.0.1 in Windows server 2003 . The database starts fine with old parameter value.I searched in Metalink and in Google but no exact solution for this error . Can any body of you help me in this regard.. It is urgent....
C:\Documents and Settings\mishelpdesk.MISSERVER>d:
D:\>set oracle_sid=MISAPP1
D:\>sqlplus /nolog
SQL*Plus: Release 9.2.0.1.0 - Production on Thu Jun 15 06:32:31 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys as sysdba
Enter password:
Connected to an idle instance.
SQL> startup pfile='D:\oracle\admin\MISAPP1\pfile\init.ora';
ORA-27102: out of memory
OSD-00022: Message 22 not found; product=RDBMS; facility=SOSD
O/S-Error: (OS 8) Not enough storage is available to process this command.
Thanks in Advance...
Govind.Your problem is an OS, not Oracle problem, so it wouldn't help to play around with different init.ora parameters, as long as the basic problem persists. The note addresses W2K, you are on W2003, that may the reason for the different OSD error numbers.
For more information about AWE see on metalink
Implementing Address Windowing Extensions (AWE) or VLM on Windows Platforms
Note:225349.1
Werner -
The command TfsAdmin ProjectServer /RegisterPWA causes next error:
TF244069: An error occurred while checking the provisioning status of the reporting database schema for a PWA instance.
Project Server returned the following error: "Server was unable to process request. ---> The request failed with HTTP status 401: Unauthorized.".
(type ProvisionException)
Exception Stack Trace: at Microsoft.TeamFoundation.Sync.Provisioning.ProvisionPwaDBSchema.HandleSoapException(SoapException soapException, String errorResourceString)
at Microsoft.TeamFoundation.Sync.Provisioning.ProvisionPwaDBSchema.IsDBSchemaProvisioned()
at Microsoft.TeamFoundation.Sync.Provisioning.ProvisionManager.Provision()
I installed SharePoint 2013 and Project Server 2013 as farm and TFS 2012 and my account has permissions everywhere. I read article
http://msdn.microsoft.com/en-us/library/gg412653.aspx and gave full permissions for TFS account to SQL and Project, Project app pool account to SQL, but still have an error.
How can I find out what exactly permissions are not enough???The problem was in claims authentication. Changed to Windows and all worked out.
-
BIB-16613 Database access error occurred while connecting to the OLAP insta
I am trying to connect to the database using the BI Beans sample bootstrap.jpr
I am getting the BIB-16613 error.
oracle.dss.security.BISecurityException: BIB-16613 Database access error occurred while connecting to the OLAP instance.
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
The bi_checkconfig utility gives me:
C:\utils\JDev903\bibeans\bin>bi_checkconfig -h pavelr -po 1521 -sid LOCAL -u BIBDEMO -p BIBDEMO
BI Beans Diagnostics(v1.0.0.0) 17/03/03
===============================================================================
JDEV_ORACLE_HOME ............................. = C:\utils\JDev903
JAVA_HOME .................................... = C:\OraHome1\jdk
JDeveloper version ........................... = 9.0.3.1035 (Production)
BI Beans version ............................. = 9.0.3.4.0
BI Beans internal version .................... = 2.7.0.11.3
Connect to database .......................... = Successful
JDBC driver version .......................... = 9.2.0.1.0
JDBC JAR file location ....................... = C:\utils\JDev903\jdbc\lib
Database version ............................. = 9.2.0.2.1
OLAP Catalog version ......................... = N/A
OLAP AW Engine version ....................... = N/A
OLAP API Server version ...................... = N/A
BI Beans Catalog version ..................... = N/A; not installed in BIBDEMO
OLAP API JAR file version .................... = 9.2
OLAP API JAR file location ................... = C:\utils\JDev903\jdev\lib\ext
Load OLAP API metadata ....................... = Successful
Number of metadata folders ................... = 3
Number of metadata measures .................. = 26
Number of metadata dimensions ................ = 22
Metadata output location ..................... = C:\utils\JDev903\bibeans\bin\bi_metadata.txt
I can connect to OLAP BIBDEMO (and SH) schema using OEM.
I can connect to BIBDEMO from JDev Connections (Catalog connection to BIBCAT, OLAP connection to BIBDEMO).
How can I establish the connection from the bootstrap sample?
PavelPlease try follow the steps under "Installing and Configuring the Samples "http://otn.oracle.com/products/bib/htdocs/samples/installing_samples.html - the section titled "Update the samples project settings".
Maybe you are looking for
-
I have always been able to open my emails and access their contents using Firefox. Now, this morning, I can no longer access the contents of my emails, but can still open them. I called 'virginmedia' who told me to try using Explorer, which worked, a
-
Problem while loading the log4j.xml in to the classpath
Hi, I am working with a web application using tomcat5.0.I am using log4j for logging the information in my application.I am keeping log4j.xml out side of the application(Generally we will keep under WEB-INF/classes ).Now I want to load the log4j.xml
-
Itunes wont load asking - verify you have sufficient permissions to start service
hi i am trying to re-install itunes on my Window7 PC and the install stops and asks Apple Mobile Service failed to start - verify you have sufficient permissions to start service Help please
-
How do I get surround sound after compressing a movie using compressor
I am using compressor to create files for authoring DVDs using DVD Studio Pro 4. I want to get surround sound 5.1. How do I go about doing it? I have using Dolby 2.0 so far. Thanks for your help.
-
Interfaces instead of multiple inheritance?
I've read that "The Java programming language does not permit multiple inheritance , but interfaces provide an alternative." But I also read contradictory information-There are no method bodies in an interface. Java interfaces only contain empty meth