Insert data into a database table from a string
Hi,
I am need to insert data into a table from the text file. I pull the data into an internal table using GUI_UPLoad. I read the data into an internal table and concatenate data into a string. I need to do this because the structure of the table is dynamic. it is used to upload a series of tables each with different structure, But the data is stored in the string v_tabledata. How to do that.
after uploading the data from the textt file into a table
oop at i_final.
v_tabname = i_final-table_name.
concatenate i_final-table_rec1 i_final-table_rec2 i_final-table_rec3
i_final-table_rec4 i_final-table_rec5 into v_tabledata.
from 'v_table data' i need to upload the data into a table and the structue of the table is known dynamically. Any thoughts using field symbols?
Thanks,
VG
Let me see if I've understood your issue
You have a file to be uploaded into an internal table but this file has many different layouts and then you don't know how to link these fields with the internal table...is it your issue?
Then you've read the internal table, you've sent it to a string divided by space or something else and then are you trying to read this string to send it to a table?
We could read the standard tables which maintain the program names, table names etc... (DD* tables, as the DD03L table) and then create some rules...
We could create a parameter table to read your file/table dynamically...
Please, try to rewrite in other words your problem...because there are a lot of ways to achieve your issue...
Alexandre Mendes
Similar Messages
-
How to insert data into custom database table from an hcsf
i want to insert data into database table that i have created from an hcsf.
example :
say i have created a table in oracle database and i hav created a hcsf file.now i want that when somebody fills in that hcsf and click submit ,i want that entries should be updated in my database table.
plzzz reply ASAP(it's urgent)you'll need a bit of Java code... extract the data during a check-in filter, and insert it into the database.
check out the "DataAccess" component in the HowToComponents for query-running examples, and the "DynamicPrefix" component for a check-in filter example.
I have older copies here:
http://bezzotech.com/library -
Insert Data into a PK Table from a Non-PK Table
Suppose I have a Table A with 10 columns in Schema 1 and there are 100 records in it. Now I create a Table B with the same 10 columns but create 4 columns as Primary Key in another Schema 2. I want to Insert the data from Table A into Table B but the 100 rows of data have duplicate entries of Primary Key and so I get Primary Key constraint violation. I want to know whether I will be able to Insert data by a quey and if so how?
Tried to simulate ur scenario in my environment...check the insert statement...you can implement it to get ur solution.
Here it goes:
SQL> desc testt; <table u want to insert from,this has no pk>
Name Null? Type
DEPTNO NUMBER
JOB VARCHAR2(10)
SQL> desc testt_t;<table to be loaded,table with pk>
Name Null? Type
DEPTNO NOT NULL NUMBER
JOB VARCHAR2(10)
SQL> select * from testt;
DEPTNO JOB
10 aaa
11 bbb
12 ccc
10 aaa
11 bbb
12 ccc
10 aaa
7 rows selected.
SQL> select * from testt_t;
no rows selected
SQL> insert into testt_t (select t1.deptno,t1.job from testt t1 where t1.rowid =(select min(t2.rowid
) from testt t2 where t1.DEPTNO=t2.DEPTNO and t1.JOB=t2.job));
3 rows created.
SQL> -
Import Excel File Data into oracle database table.
HI,
i want to insert data into a specific table from a excel file. please help me..
for example
emp.xls file's data need to be import in emp database table.
thanks in advance...Hi,
to all knowledgable person, this would be gald for u all that i have solved the problem.
through this procedure..
PROCEDURE IMPORT_FROM_EXCEL_PROC (as_FileName VARCHAR2, exe_name varchar2) IS
appid PLS_INTEGER;
convid PLS_INTEGER;
docid PLS_INTEGER;
conv_established BOOLEAN := FALSE;
buffer VARCHAR2(100);
Emp_code VARCHAR2(100);
Emp_name VARCHAR2(100);
Emp_desig VARCHAR2(100);
Emp_Salary VARCHAR2(100);
ls_error VARCHAR2(1000);
li_row integer;
li_col integer;
li_error_count integer;
li_load_count integer;
BEGIN
--Start Excel
--This line assumes that Excel is in the specified directory
-- APPID := DDE.APP_BEGIN('D:\OFFICE11\EXCEL.EXE',DDE.APP_MODE_MINIMIZED);
APPID := DDE.APP_BEGIN(exe_name,DDE.APP_MODE_MINIMIZED);
--Establish a conversation with Excel
--The following loop will not end until a conversation with Excel
--has been established. Therefore, it can result in a endless loop,
--so use with caution.
WHILE NOT conv_established LOOP
BEGIN
convid := DDE.INITIATE('excel', 'system');
conv_established := TRUE;
EXCEPTION
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
conv_established := FALSE;
END;
END LOOP;
--Open Excel document
--This assumes that you have an Excel spreadsheet named ddetest.xls in the root of c:
DDE.EXECUTE(convid, '[Open("'||as_FileName||'")]', 10000);
--Initiate conversation with Excel document
docid := DDE.INITIATE('excel',as_FileName);
--Begin transfer from Excel to Forms
li_load_count := 0;
li_error_count := 0;
li_col := 1;
li_row := 2;
GO_BLOCK('IMPORT_XLS');
DDE.REQUEST (docid, 'R' || TO_CHAR(li_row) || 'C' || TO_CHAR(li_col), buffer, DDE.CF_TEXT, 1000);
WHILE length(buffer) > 2 LOOP
WHILE li_col < 5 LOOP
buffer := substr(buffer, 1, instr(buffer, chr(10)) - 2);
IF li_col = 1 THEN --Emp_code
Emp_code := buffer;
ELSIF li_col = 2 THEN --Emp_name
Emp_name := buffer;
ELSIF li_col = 3 THEN --Emp_desig
Emp_desig := buffer;
ELSE --Emp_salary
Emp_salary := buffer;
END IF;
IF nvl(ls_error,'N') = 'N' THEN
li_col := li_col + 1;
DDE.REQUEST (docid, 'R' || TO_CHAR(li_row) || 'C' || TO_CHAR(li_col), buffer, DDE.CF_TEXT, 1000);
ELSE
li_col := 5;
END IF;
END LOOP;
IF nvl(ls_error, 'N') = 'N' THEN
li_load_count := li_load_count + 1;
IF li_load_count = 1 THEN
FIRST_RECORD;
ELSE
NEXT_RECORD;
END IF;
:IMPORT_XLS.Emp_code := Emp_code;
:IMPORT_XLS.Emp_name := Emp_name;
:IMPORT_XLS.Emp_desig := Emp_desig;
:IMPORT_XLS.Emp_salary := Emp_salary;
ELSE
li_error_count := li_error_count + 1;
DDE.POKE(docid, 'R' || TO_CHAR(li_row) || 'C5', ls_error, DDE.CF_TEXT, 10000);
END IF;
ls_error := '';
Emp_code := '';
Emp_name := '';
Emp_desig := '';
Emp_salary := '';
li_col := 1;
li_row := li_row + 1;
DDE.REQUEST (docid, 'R' || TO_CHAR(li_row) || 'C' || TO_CHAR(li_col), buffer, DDE.CF_TEXT, 1000);
END LOOP;
IF li_error_count > 0 THEN
DDE.EXECUTE(convid, '[[save]]', 10000);
Message(TO_CHAR(li_load_count) || ' Record(s) Loaded. ' ||
TO_CHAR(li_error_count) || ' Invalid Record(s). See error in excel file.');
ELSE
Message(TO_CHAR(li_load_count) || ' Record(s) Successfully Loaded.');
END IF;
--End transfer to Excel
DDE.TERMINATE(docid);
DDE.TERMINATE(convid);
DDE.APP_END(appid);
--Handle exceptions
EXCEPTION
WHEN DDE.DDE_APP_FAILURE THEN
MESSAGE('WINDOWS APPLICATION CANNOT START.');
WHEN DDE.DDE_PARAM_ERR THEN
MESSAGE('A NULL VALUE WAS PASSED TO DDE');
WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION');
WHEN DDE.DMLERR_NOTPROCESSED THEN
MESSAGE('A TRANSACTION FAILED');
END; -
Insert data into msql thru table trigger
Hi,
I installed dg4msql 11.2 and I would like to insert some data into our msql thru one of our Oracle table after insert table,
I used the syntax below
insert into test@dg4msql ("PN") values (:new.PN)
but the below error problem if I insert data into my Oracle table,
ORA-02054: transaction 4.17.15898 in-doubt
ORA-028500, connect from ORACLE to a non-Oracle system returned this message
[Oracle][ODBC SQL Server Driver][SQL Server] Invalid object name "RECOVER.HS_TRANSACTION_LOG
Do I have to create the HS_TRANSACTION_LOG table in my msql server to resolve this problem?
Thanks
VincentVincent,
If the gateway insert is being done as part of a trigger then it will almost certainly be part of a distributed transaction so yes, you will have to create the transaction log table and the recovery user in the SQL*Server database.
As well as the gateway documentation have a look at this note in My Oracle Support -
Note.227011.1 How to Setup DG4MSQL to Use Distributed Transactions (Doc ID 227011.1)
Regards,
Mike -
Drop, create and insert data into few intermediate tables
Hi All,
I need to schedule a process to drop, create and insert data into few intermediate tables on a weekly basis. Here is what i need to do in the stored procedure, which can be scheduled weekly.
DROP TABLE TABLE_NAME1;
DROP TABLE TABLE_NAME2;
DROP TABLE TABLE_NAME3;
CREATE TABLE TABLE_NAME1
CREATE TABLE TABLE_NAME2
CREATE TABLE TABLE_NAME3
INSERT INTO TABLE_NAME1 SELECT ....;
INSERT INTO TABLE_NAME2 SELECT ....;
INSERT INTO TABLE_NAME3 SELECT ....;
Any suggestions, examples or code on how to accomplish this task would be very helpful. Any question pls let me know.
Thanks in advance.I am using the intermediate tables in an extract process. The idea was that the table would be created prior to calling the extract procedure and once the data written to the intermediate table had been processed the table would be dropped. This would be repeated each time the extract process is run. From a DBA's point or view, would it be better to just leave the table on the database and truncate it after each run or is removing it entirely best?
-
How to insert data into the mysql table by giving as a text file
Hi,
Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
Thanks:)At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).
-
How to insert data into local database from oracle server
I am new in C#.
I am trying to design a local database in my C# project and I am trying to sync my database with our oracle server. I can login using oracle server. But I can't insert data into my local database from oracle server.
anybody can help me ...............
thanks..............................You can use SSIS package for that
Start a new Integration Services project in Business Intelligence Development Studio/ SSDT. Add a new SSIS package with a data flow task. Add a OLEDB source to connect to Oracle server and add a OLEDB Destination to connect to your local database.
Select tables for source and destination. On executing package source data will get transferred to your local database.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
DB Adapters inserting data into 2 diff tables of same database giving issue
Hello,
I am using Oracle soa suite 11g BPEL.
I need to insert data in 4 different tables of same Oracle database with the requirement of rollback all data if error occurs anywhere.
I have configured the DB adapater as XA enabled on console .
In code:-
I am using 2 DBAdapters to insert data one by one in 2 diff tables of same DB (using INSERT ONLY operations). Before each invoke activity i am using a transformation activity to prepare the input variable of the DBAdapter.
When i run this code i get below error:-
Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [DBINS_DIANA.XxontPoiHdrsIface]. Caused by java.sql.BatchUpdateException: ORA-02049: timeout: distributed transaction waiting for lock . ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary>
If i use a wait activity between the 2 invokes i get the data inserted fine , but that means the transactions between inserts would be committed which i want to be rollback fully in case of any errors.
Can anyone have a clue what is wrong here?
Thanks
ShivaniHi Anagha,
Have a look at these links:
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/2b/d5653fd1d3b81ae10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/frameset.htm
Regards,
Chandra -
Urgent help needed in inserting data into a custom table in oracle WorkFlow
Hi
I am trying to get data from the WF and insert into a custom table..
I read that workflow procedures WONT allow commits...
Oracle Workflow will not support autonomous commits in any procedure it calls directly. If you need to perform commits, then embed your SQL in a subprocedure and declare it as an autonomous block. This subprocedure must be capable of being rerun. Additionally, note that Oracle Workflow handles errors by rolling back the entire procedure and setting its status to ERROR. Database updates performed by autonomous commits cannot be rolled back, so you will need to write your own compensatory logic for error handling
Have anyone did this..
Please give me some idea ...It is urgent
I am getting data using getitemattribute..and try to insert it into a custom table
thanks
kpPl do not post duplicate threads - insert dont work in Workflow
Srini -
Insert data into oracle database using a PHP form
I'm trying to enter data into my oracle database table using a php form. When I click submit no data is added. Could someone help me please. I'm new to php/oracle thing.
NOTE: I don't have any problem connecting to the database using php.
Here is the code I'm using:
<?php
// just print form asking for name if none was entered
if( !isset($query)) {
echo "<form action=\"$uri\" method=post>\n";
echo "<p>Enter Name: ";
echo "<input type=text size=100 maxlength=200 name=data value=\"$data\">\n";
echo "<br><input type=submit name=submit value=Submit>\n";
echo "</form>\n";
exit;
// insert client's name
$query = "INSERT INTO client (name) VALUES ($data)";
// connect to Oracle
$username = "xxxx";
$paswd = "yyyyyy";
$dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
"(HOST=patriot.gmu.edu)(PORT=1521))".
"(CONNECT_DATA=(SID=COSC)))";
$db_conn = ocilogon($username, $paswd, $dbstring);
$stmt = OCIParse($db_conn, $query);
OCIExecute($stmt, OCI_DEFAULT);
OCIFreeStatement($stmt);
OCILogoff($db_conn);
?>
Thanks for your help. I will also appreciate a better was to do it.
Tonyresumption and jer,
Sorry I cannot format the code for easy reading!
The page is submitting to itself. See action = \"$uri\". I used the same logic to enter SELECT querries into the database. It pulls and displays data back on the webpage. The code I used for this is below. Compare it with the one above for inserting data into the table.
<?php
// connect to oracle
$username = "xxxxx";
$paswd = "yyyyy";
$dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
"(HOST=patriot.gmu.edu)(PORT=1521))".
"(CONNECT_DATA=(SID=COSC)))";
$db_conn = ocilogon($username, $paswd, $dbstring);
// username and password will be unset if they weren't passed,
// or if they were wrong
if( !isset($query)) {
// just print form asking for account details
echo "<form action=\"$uri\" method=post>\n";
echo "<p>Enter Query: ";
echo "<input type=text size=100 maxlength=200 name=query value=\"$query\">\n";
echo "<br><input type=submit name=submit value=Submit>\n";
echo "</form>\n";
exit;
// remove unwanted slashes from the query
$query = stripslashes($query);
// run the query
$stmt = OCIParse($db_conn, $query);
OCIExecute($stmt, OCI_DEFAULT);
// Open the HTML table.
print '<table border="1" cellspacing="0" cellpadding="3">';
// Read fetched headers.
print '<tr>';
for ($i = 1;$i <= ocinumcols($stmt);$i++)
print '<td class="e">'.ocicolumnname($stmt,$i).'</td>';
print '</tr>';
// Read fetched data.
while (ocifetch($stmt))
// Print open and close HTML row tags and columns data.
print '<tr>';
for ($i = 1;$i <= ocinumcols($stmt);$i++)
print '<td class="v">'.ociresult($stmt,$i).'</td>';
print '</tr>';
// Close the HTML table.
print '</table>';
OCIFreeStatement($stmt);
OCILogoff($db_conn);
?> -
Native SQL: insert data into oracle database, no return message.
hi,
the statement : insert into <TableName> values (Source)
how can I know if the data have already insert to the database table?
now I have a program have this problem: the data has already exist, but there's no error message return when insert the same data again.
data: dbs like dbcon-con_name value 'HRGK',
dbtype type dbcon_dbms.
data: sqlerr_ref type ref to cx_sql_exception,
exc_ref type ref to cx_sy_native_sql_error,
error_text type string.
data: cnt type i,
i(2) type c.
set locale language 'E'.
EXEC SQL.
CONNECT TO :DBS
ENDEXEC.
EXEC SQL.
SET CONNECTION :DBS
ENDEXEC.
EXEC SQL.
SELECT COUNT(*) from org_unit into :cnt
ENDEXEC.
write: / cnt.
*do.
i = 'A'.
try.
EXEC SQL.
BEGIN
insert into ORG_UNIT ( ORGAN_ID, UNIT_NO, UNIT_NAME, PARENT_ID)
values ( 'A', '123412', 'SDFSG', 'DDS'); " ORGAN_ID is primary key
" If the data 'A' has already exist in database ORG_UNIT, it will show error message
" But if I use :I instead 'A', it will not show error message.
IF SQL%FOUND THEN
COMMIT;
END IF;
END;
endexec.
EXEC SQL.
SELECT COUNT(*) from ORG_UNIT into :cnt
ENDEXEC.
write: / cnt.
catch cx_sy_native_sql_error into exc_ref.
error_text = exc_ref->get_text( ).
write: / error_text.
catch cx_sql_exception into sqlerr_ref.
perform handle_sql_exception using sqlerr_ref.
endtry.
EXEC SQL.
disconnect :DBS
ENDEXEC.
*enddo.
*& Form handle_sql_exception
form handle_sql_exception
using p_sqlerr_ref type ref to cx_sql_exception.
format color col_negative.
if p_sqlerr_ref->db_error = 'X'.
write: / 'SQL error occured:', p_sqlerr_ref->sql_code,
/ p_sqlerr_ref->sql_message. "#EC NOTEXT
else.
write:
/ 'Error from DBI (details in dev-trace):',
p_sqlerr_ref->internal_error. "#EC NOTEXT
endif.
endform. "handle_sql_exception
please help to see the words:
*" If the data 'A' has already exist in database ORG_UNIT, it will show error message*
*" But if I use :I instead 'A', it will not show error message.*
in the program.
Thanks a lot!resumption and jer,
Sorry I cannot format the code for easy reading!
The page is submitting to itself. See action = \"$uri\". I used the same logic to enter SELECT querries into the database. It pulls and displays data back on the webpage. The code I used for this is below. Compare it with the one above for inserting data into the table.
<?php
// connect to oracle
$username = "xxxxx";
$paswd = "yyyyy";
$dbstring = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)".
"(HOST=patriot.gmu.edu)(PORT=1521))".
"(CONNECT_DATA=(SID=COSC)))";
$db_conn = ocilogon($username, $paswd, $dbstring);
// username and password will be unset if they weren't passed,
// or if they were wrong
if( !isset($query)) {
// just print form asking for account details
echo "<form action=\"$uri\" method=post>\n";
echo "<p>Enter Query: ";
echo "<input type=text size=100 maxlength=200 name=query value=\"$query\">\n";
echo "<br><input type=submit name=submit value=Submit>\n";
echo "</form>\n";
exit;
// remove unwanted slashes from the query
$query = stripslashes($query);
// run the query
$stmt = OCIParse($db_conn, $query);
OCIExecute($stmt, OCI_DEFAULT);
// Open the HTML table.
print '<table border="1" cellspacing="0" cellpadding="3">';
// Read fetched headers.
print '<tr>';
for ($i = 1;$i <= ocinumcols($stmt);$i++)
print '<td class="e">'.ocicolumnname($stmt,$i).'</td>';
print '</tr>';
// Read fetched data.
while (ocifetch($stmt))
// Print open and close HTML row tags and columns data.
print '<tr>';
for ($i = 1;$i <= ocinumcols($stmt);$i++)
print '<td class="v">'.ociresult($stmt,$i).'</td>';
print '</tr>';
// Close the HTML table.
print '</table>';
OCIFreeStatement($stmt);
OCILogoff($db_conn);
?> -
Use Spry to insert data into a database?
I'm new to Spry, so I have a question:
Can I use Spry to insert data into a MySQL database without
reloading the site?
Reading data from XML file works fine, but I don't know if
writing is possible..I don't get it... I tried this:
<script type="text/javascript" src="spry/xpath.js"
/></script>
<script type="text/javascript" src="spry/SpryData.js"
/></script>
<script type="text/javascript">
/* <![CDATA[ */
function subscribe() {
var subscribe;
var info =
document.getElementById("subscription_info").value;
if (document.getElementsByName("subscription")[0].checked ==
true) {
subscribe = "ja";
else {
subscribe = "nein";
var dsSubscribe = new
Spry.Data.XMLDataSet("include/inc_subscribe.php?subscribe="+subscribe+"&info="+info+"&sit e=<?=$_GET['site'];?>",
"subscription/ok");
/* ]]> */
</script>
<div id="infos">
<input type="radio" name="subscription" value="ja" />
dabei
<input type="radio" name="subscription" value="nein"
/> nicht dabei
<input type='text' class='text'
id='subscription_info_text' />
<input type='submit' id="subscription_submit"
value='Eintragen' onClick="subscribe()" />
</div>
But the data isn't inserted into the mysql database. When I
start the php script directly, it works, so I think it's not a php
problem. -
Sql/Plsql code to export data into a temporary table from a text file
Dear all,
I need to create a temporary table getting data from a text file. I am very new to data loading could you please help me how to read the text file in to a temporary table.
i have text file like as below:
order items : books Purchasing
start date:
8-11-09
Notes: Books are selling from aug10 to aug 25
Action performed
Time
Verified By
sold out from shop, sold out date:_________
1.
physics _______ book sold to ravi
2.
social _______ book this is a good book
sold to kiran
aug10th
ronald
3.
maths book to sal
4.
english book__________ this was a newbook
to raj
jak
return to shop, return date:____________
1.
maths book return by:_____________ Verify book
aug11th
john
2.
story book by:_________ checked
aug14th
Now i need to create a temporary table and insert the data into the table from this text file.
Now i need to create a temporary table named as books_order with 5columns(order,Status,Action_Performed,Time,Verified_By) like as below:
Order status Action_Performed Time Verified_By
books Purchasing sold physics _______ book sold to ravi _______ _________
books Purchasing sold social _______ book this is a good book sold to kiran aug10th ronald
books Purchasing sold maths book to sal _____ __________
books Purchasing sold english book__________ this was a newbook to raj __________ jak
books Purchasing return maths book return by:_____________ Verify book aug11th john
books Purchasing return story book by:_________ checked aug14th _________
Thanks in advance.Isn't school work marvelous?
Create an external table.
http://www.morganslibrary.org/reference/externaltab.html
Getting the data into a temporary table may make sense in SQL Server ... but not in Oracle. -
Problem with inserting data into mySQL database with jsp
I have a jsp page that collects infromation about a users vehicle and puts the data into a mySQL database. Iv'e been messing around with it for ages & i can't seem to get it to work even though i cannot see anything wrong with the code, which can be seen below.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/connection.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="login_form.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
if (true || (session.getValue("MM_UserAuthorization")=="") ||
(MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
MM_grantAccess = true;
if (!MM_grantAccess) {
String MM_qsChar = "?";
if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
String MM_referrer = request.getRequestURI();
if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
return;
String vehicle_details__registration = null;
if(request.getParameter("txt_registration") != null){ vehicle_details__registration = (String)request.getParameter("txt_registration");}
String vehicle_details__make = null;
if(request.getParameter("txt_make") != null){ vehicle_details__make = (String)request.getParameter("txt_make");}
String vehicle_details__model = null;
if(request.getParameter("txt_model") != null){ vehicle_details__model = (String)request.getParameter("txt_model");}
String vehicle_details__colour = null;
if(request.getParameter("txt_colour") != null){ vehicle_details__colour = (String)request.getParameter("txt_colour");}
String vehicle_details__tax_class = null;
if(request.getParameter("select_tax_class") != null){ vehicle_details__tax_class = (String)request.getParameter("select_tax_class");}
String vehicle_details__chasis_num = null;
if(request.getParameter("chasis_num") != null){ vehicle_details__chasis_num = (String)request.getParameter("chasis_num");}
String vehicle_details__status = null;
if(request.getParameter("radio_status") != null){ vehicle_details__status = (String)request.getParameter("radio_status");}
String owner_details__MMColParam = "1";
if (session.getValue("MM_Username") !=null) {owner_details__MMColParam = (String)session.getValue("MM_Username");}
Driver Drivervehicle_details = (Driver)Class.forName(MM_connection_DRIVER).newInstance();
Connection Connvehicle_details = DriverManager.getConnection(MM_connection_STRING,MM_connection_USERNAME,MM_connection_PASSWORD);
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
vehicle_details.executeUpdate();
%>
<form name="add_vehicle_form" id="add_vehicle_form">
<p>Registration mark:
<input name="txt_registration" type="text" id="txt_registration">
</p>
<p>Make:
<input name="txt_make" type="text" id="txt_make">
</p>
<p>Model:
<input name="txt_model" type="text" id="txt_model">
</p>
<p>Colour:
<input name="txt_colour" type="text" id="txt_colour">
</p>
<p>Tax Class:
<select name="select_tax_class" id="select_tax_class">
<option value="AAA">Band AAA (up to 100g/km)</option>
<option value="AA">Band AA (101 - 120g/km)</option>
<option value="A">Band A (121 - 150g/km)</option>
<option value="B">Band B (151 - 165g/km)</option>
<option value="C">Band C (166 - 185g/km)</option>
<option value="D">Band D (Over 185g/km)</option>
</select>
</p>
<p>Chasis Number:
<input name="txt_chassis_num" type="text" id="txt_chassis_num">
</p>
<p>Status: active:
<input name="radio_status" type="radio" value="1" checked>
off-road
<input name="radio_status" type="radio" value="0">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
Connvehicle_details.close();
%>This is the error I am getting from the server
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 3 in the jsp file: /add_vehicle_form.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\Assignment\org\apache\jsp\add_005fvehicle_005fform_jsp.java:113: ')' expected
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Any help would be much appreciated.
Thanksuse this ...
PreparedStatement vehicle_details =
Connvehicle_details.prepareStatement("INSERT INTO
vehicle_man_db.vehicle_details (registartion, make,
model, colour, tax_class, chasis_num) VALUES
vehicle_details .setString(1,String
vehicle_details__registration );
vehicle_details setString(2,String
vehicle_details__make );
vehicle_details .setString(3,String
vehicle_details__model );
vehicle_details .setString(4,vehicle_details__colour
vehicle_details .setString(5,String
vehicle_details__tax_class);
vehicle_details .setString(6,String
vehicle_details__chasis_num );
vehicle_details .executeQuery();Even you need a screwing up... what's the point putting that String inside. That's the bloody error.
Maybe you are looking for
-
Windows 8.1 is facing a problem while taking System Image Backup on DVD, it pops an error saying 0x80040154 and more it says that class is not registered , i am trying from days to find some optimum solution for it apart from taking it on external h
-
Adobe Acrobat Reader XI keeps installing on my Computer (without authorization) Why?
I am running Adobe Acrobat Pro and every couple of weeks I have to uninstall the Reader that downloads from nowhere to that I can use Pro. What is going on?? I don't see it in the Creative Cloud Manager......where the heck is this coming from!!!! Its
-
BPM Send Step with acknowledgment: ID: sender agreement?
Hello everybody, I have a send step in BPM and I expect a acknowledgement from the receiver. Do I have to configure a sender agreement? Thanks a lot Regards Mario
-
Cannot restore iPad mini from iOS 6.1 to 6.0
I backup my ipad mini while have ios 6.1.3, and now i bought new ipad mini and need to restore that backup to it but it have ios 6.0 and i'm not able to restore lack of ios maybe.. Any one have any idea, and if i update my new ipad mini with ios 7 wi
-
Question about downloading e-books
What do I need to do so I can put Amazon Kindle books on my iPad?