INSERT INTO statement in java servlet.
Hiya
Was wondering if anyone knew how to use variables from an html form into a sql insert into statement? The constants work ok below, its just getting the variables to work.
//constants work ok.
rs = stmt.executeQuery("INSERT INTO ACCOUNTS " + " VALUES ('un', 'test2', 'test2', 'test2', 'test', 'test', 'test', 'test', 'test')");
//doesn't do anything no errors.
rs = stmt.executeQuery("INSERT INTO ACCOUNTS " + " VALUES ( '"+uname+"', " + " '"+fname+"', " + " '"+sname+"'," + "'"+address1+"'," + "'"+address2+"'," + "'"+town+"'," + "'"+county+"'," + "'"+postcode+"')");
<html>
<head>
<title>
CreateAccount
</title>
</head>
<body>
<form method=get action=/servlet/website.CreateAccount>
<p> Username:
<input type=text name="username"> </p>
<p> Password:
<input type=text name="password"> </p>
<p> First Name:
<input type=text name="firstname"> </p>
<p> Surname:
<input type=text name="surname"> </p>
<p> 1st Line of Address:
<input type=text name="1address"> </p>
<p> 2nd Line of Address:
<input type=text name="2address"> </p>
<p> Town:
<input type=text name="town"> </p>
<p> County:
<input type=text name="county"> </p>
<p> Postcode:
<input type=text name="postcode"> </p>
<input type=submit>
</form>
</body>
</html>
package website;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class CreateAccount extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
/**Initialize global variables*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
/**Process the HTTP Get request*/
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
ResultSet rs = null;
Connection con = null;
res.setContentType("text/html");
PrintWriter out = res.getWriter();
//get the variables entered in the form
String uname = req.getParameter("username");
String pwd = req.getParameter("password");
String fname = req.getParameter("firstname");
String sname = req.getParameter("surname");
String address1 = req.getParameter("1address");
String address2 = req.getParameter("2address");
String town = req.getParameter("town");
String county = req.getParameter("county");
String postcode = req.getParameter("postcode");
try {
// Load the database driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// Get a Connection to the database
con = DriverManager.getConnection("jdbc:odbc:account", "", "");
//Add the data into the database
try
String sql = "INSERT INTO ACCOUNTS " + " VALUES (?,?,?,?,?,?,?,?)";
PreparedStatement statement = con.prepareStatement(sql);
statement.setString(1, uname);
statement.setString(2, fname);
statement.setString(3, sname);
statement.setString(4, address1);
statement.setString(5, address2);
statement.setString(6, town);
statement.setString(7, county);
statement.setString(8, postcode);
int numRowsChanged = statement.executeUpdate(sql);
statement.close();
//Statement stmt = null;
//stmt = con.createStatement();
//Create a Statement object
//constants work ok.
//rs = stmt.executeQuery("INSERT INTO ACCOUNTS " + " VALUES ('uname', 'test2', 'test2', 'test2', 'test', 'test', 'test', 'test', 'test')");
catch (Exception e)
// show that the new account has been created
out.println("<p> New account created: </p>");
out.println(" '"+uname+"'");
catch(ClassNotFoundException e) {
out.println("Couldn't load database driver: " + e.getMessage());
catch(SQLException e) {
out.println("SQLException caught: " + e.getMessage());
finally {
// Always close the database connection.
try {
if (con != null) con.close();
catch (SQLException ignored) { }
}ok now the regular statement with constant values inserts data into the database (the regular statement is being used with a result set ) but the prepared statement does not - there are no error messages but it does not insert any data either. The data is going into the variables due to the system.out.println, but is it going into the prepared statement? I believe the prepared statement is being executed with the executeupdate method.
Similar Messages
-
Please help --Error in insert into Statement
Error in insert into statement while connecting to ms-access.
import java.sql.*;
public class stupid8
public stupid8()
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};"+"DBQ=d:/Servlet/registration.mdb");
PreparedStatement s=con.prepareStatement("insert into Deposit (username,date,amount) values(?,?,?)");
s.setString(1,"username");
s.setString(2,"date");
s.setString(3,"amount");
s.executeUpdate();
System.out.println("Success");
catch(Exception e)
System.out.println("Error: "+e);
public static void main(String args[])
new stupid8();
}My first guess is that the database is objecting to the use of "date" as a column name; "date" is often a reserved word in databases.
It would be less of a guess if you posted the actual error message. -
How to translate this statement to java servlet code
INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)You wouldn't translate that statement to servlet code. The idea doesn't make any sense. However you might include it in a servlet; read the tutorial that zadok linked to.
-
Error with INSERT INTO statement
My INSERT statement looks like the following:
String insert = "INSERT INTO UserDetails (lockedOut) VALUES (1)
where registrationNo = ('"+registrationNo+"')";
stmt.executeUpdate(insert);
The error message:
Missing semicolon (;) at end of SQL statement.
I've been trying to figure this out for 2 days now - has anyone got a suggestionHi.
You need to add a semicolon inside the string.
String insert = "INSERT INTO UserDetails (lockedOut) VALUES (1)
where registrationNo = ('"+registrationNo+"') ; ";
Nimo. -
Oracle table(s) data to INSERT(String) statements with JAVA
Hi,
How can I get sql inserts from a oracle table with JAVA?
Is there a Oracle API for it?
I need to store it in a file, the result file should have these examples lines:
-- INSERTING into TEST
Insert into "TEST" ("CODE","FAMILY","SUB_FAMILY","SEVERITY","STATUS","ANOMALY_DATE","DESCRIPTION",
"COMMENTS","VALUE0","VALUE1","VALUE2","VALUE3","VALUE4","VALUE5","VALUE6","VALUE7","VALUE8",
"VALUE9") values (1,'family1','subFamily11','bad','initial',to_date('0005-11-21','DD/MM/RR'),'someDescription',
'someComment','someValue','someValue','someValue','uselessValue','uselessValue',null,null,null,null,null);
the example line was created with the export tool from Oracle SQl developer
Thks.
Franciscouser9046632 wrote:
Hi Guys, this is me Francisco that wrote the first question, but now I've an NEW account. I'll try to explain it. For a Job I need a .txt file that contains the SQl string inserts from an Oracle Table. I can't use a Software because I need to do it with Java Code. I'm not trying to get the inserts's logging , I need a to export it from a table.I read One way to do it is using DataPump utility, but using this tools, will I get a text file? I read that DataPump works with binaries files. using Java JDBC and metadata, I need to convert all in String file, ok for it I'm agree, but I have to write a lot of code to know what kind of type I get from the Table to parse it. One example is with Date types, oracle softwares parse it as to_date('0005-11-21','DD/MM/RR') and java toTostrig will do it something like '2009-1-25 13:00:00'. Java toString method will truncate some Number types So I need to know if someone did it or give or can help me.
Thank you very much. Francisco
Again, explain the business problem you are trying to solve, not the technical one. WHY do you need a text file that contains "SQL string inserts"? It sounds very much like you are looking at your problem "through the wrong end of the telescope" and thus finding a poorly designed solution. But unless we know the real problem to be solved, it's hard to say any more than that this smells bad.
Sorry about my English, it's not my natural language -
Error while inserting into ms access using jsp
i am using the following code to insert values from textboxes into access database
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(url);
Statement stmt=con.createStatement();
//ResultSet rs = null;
//String sql = ("INSERT INTO co-ords VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ");
String sql = "INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ";
out.println(sql);
stmt.executeUpdate(sql);
the output i get is
INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('cck','28.656529681148545','77.23440170288086','28','77','39','14','23.508','3.8472') Exception:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
can somebody help me?Simple,
Some error in your query right. Unable to understand Quotation stuff.
Well understand it properly else error will follow forever :)
Without String, Straight Away Values
stmt1.executeUpdate("insert into Login_Details values('Example','Exmaple')");This is the query with Login_Id Pass_Word String containing the value
stmt1.executeUpdate("insert into Login_Details values('"+Login_Id+"','"+Pass_Word+"')");Then storing sql as string and pass it in executeUpdate(sql)
String sql="insert into Login_Details values ('example','example') "String + Values in String
String sql="insert into Login_Details values ('"+example+"','"+example+"') "Just first it . Hope this reply solve ur SQL EXCEPTIONG
Sachin Kokcha -
Inserting into MsAccess Database
Hi,
I am having problem with inserting a row into the MsAccess Database. I am getting error like
"SQLException: Occurred while performing Database Operations ---> method Main() java.sql.SQLException
: [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO statement.[Microsoft][ODB
C Microsoft Access 97 Driver] Syntax error in INSERT INTO statement".
My code is as under:
please help me out.
Smitha
==========================================
package dao;
import utils.GeneralFailureException;
import dbConnection.dbConnection;
import java.util.*;
import java.sql.*;
public class GeneralExpenses {
dbConnection dbCon = new dbConnection();
public GeneralExpenses() {
super();
public static java.sql.Timestamp getTstamp() {
java.util.Date date = (Calendar.getInstance()).getTime();
java.sql.Timestamp tStamp = new java.sql.Timestamp(date.getTime());
System.out.println("The Time Stamp : " + tStamp);
return tStamp;
public void insertExpenseTable(String sExphead, double dAmount, String sMode)
throws GeneralFailureException, SQLException, ClassNotFoundException {
String inssql = "INSERT INTO EXPENSES(tnum, date , " + sExphead + ", " + sMode + ") VALUES(?,?,?,?)";
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = dbCon.getConnection();
pstmt = conn.prepareStatement(inssql);
pstmt.setInt(1, 100);
pstmt.setTimestamp(2, getTstamp());
pstmt.setDouble(3, dAmount);
pstmt.setString(4, sMode);
pstmt.executeUpdate();
} finally {
dbCon.closeAll(pstmt, conn);
public static void main(String[] args) {
try {
GeneralExpenses ge = new GeneralExpenses();
ge.insertExpenseTable("xxxxxxx", 250.35, "yyyyyyyy");
System.out.println("worked");
} catch(ClassNotFoundException sqlex) {
System.err.print("SQLException: Occurred while performing Database Operations ---> method Main() " + sqlex);
System.err.println(sqlex.getMessage());
catch(SQLException sqlex) {
System.err.print("SQLException: Occurred while performing Database Operations ---> method Main() " + sqlex);
System.err.println(sqlex.getMessage());
} catch(GeneralFailureException e) {
System.err.print("GeneralFailureException: Occurred while Establishing Connection ---> method getConnection() " + e);
System.err.println(e.getMessage());
} catch(Exception e) {
System.err.print("GeneralFailureException: Occurred while Establishing Connection ---> method getConnection() " + e);
System.err.println(e.getMessage());I'm so happy to finally found the answer of my problem with that message Kurt.
Thank you very much... !
I will now remember that date cannot be the name of a field when using jdbc-odbc. I called my field TransDate and it is now working perfectly! -
Problems with my INTO statements.
Connection connect;
JTextArea output;
JTextField textF;
public void actionPerformed ( ActionEvent e )
try {
Statement stmt = connect.createStatement();
String query = "INSERT INTO myTable" +
"VALUES ( '" +
textF.getText() + "')";
stmt.executeUpdate ( query );
stmt.close();
}catch ( SQLException ex ) {
ex.printStackTrace();
output.append ( ex.toString() );
}//actionPerformed
Problems:
Connection successful
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Syntax error in INSERT INTO statement.
whats the problem in INTO statements.Hi sellare,
String query = "INSERT INTO myTable" +
"VALUES ( '" +
textF.getText() + "')";
try putting a
System.out.print( query );
Here I modified your code and also please observe lack of space between the myTable and values.
INSERT INTO myTable VALUES ( ' .........' )
I hope this will help you out.
Regards,
Tirumalarao
Developer Technical Support,
Sun Microsystems,
http://www.sun.com/developers/support.
. -
Hi Friends
Iam trying to insert a record in MSAccess table from a legacy file. I could establish the connection to MSAccess and could able to retrive the data from it. But while inserting it gives me an error:
<b>Receiver Adapter v1109 for Party '', Service 'ORACLE_SERVER_BS':
Configured at 11:41:23 2005-10-24
Last message processing started 12:18:28 2005-10-24, Error: TransformException error in xml processor class, rollback:
Error processing request in sax parser: Error when executing statement for table/stored proc. 'VendorMaster': java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
at com.sap.aii.adapter.jdbc.xml2sql.service(xml2sql.java:179)
at com.sap.aii.adapter.jdbc.XI2JDBC.onInternalMessage(XI2JDBC.java:347)
at com.sap.aii.adapter.jdbc.SapAdapterServiceFrameImpl.callSapAdapter_i(SapAdapterServiceFrameImpl.java:170)
at com.sap.aii.adapter.jdbc.SapAdapterServiceFrameImpl.callSapAdapter(SapAdapterServiceFrameImpl.java:146)
at com.sap.aii.af.modules.CallAdapterWithMessageBean.process_receiver(CallAdapterWithMessageBean.java:204)
at com.sap.aii.af.modules.CallAdapterWithMessageBean.process(CallAdapterWithMessageBean.java:159)
at com.sap.aii.af.mp.module.ModuleLocalLocalObjectImpl1.process(ModuleLocalLocalObjectImpl1.java:103)
at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:221)
at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0.process(ModuleProcessorLocalLocalObjectImpl0.java:103)
at com.sap.aii.af.listener.AFWListenerBean.onMessage(AFWListenerBean.java:220)
at com.sap.aii.af.listener.AFWListenerLocalObjectImpl0.onMessage(AFWListenerLocalObjectImpl0.java:103)
at com.sap.aii.af.ra.ms.impl.ServicesImpl.deliver(ServicesImpl.java:274)
at com.sap.aii.adapter.xi.ms.XIEventHandler.onDeliver(XIEventHandler.java:653)
at com.sap.aii.af.ra.ms.impl.core.queue.ReceiveConsumer.invokeHandler(ReceiveConsumer.java:374)
at com.sap.aii.af.ra.ms.impl.core.queue.ReceiveConsumer.onMessage(ReceiveConsumer.java:98)
at com.sap.aii.af.ra.ms.impl.core.queue.Queue.run(Queue.java:448)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)</b>
The structure for the target field is
VendorMaster_DT
>Insert
>>VendorMaster
action
table
>>>access
VendorNumber
LastNameHi,
<i>java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] <b>Syntax error in INSERT INTO statement.</b>at com.sap.aii.adapter.jdbc.xml2sql.service(xml2sql.java:179)</i>
looks like your insert statement in the inbound message is wrong, check your inbound message...
naveen -
Using INSERT INTO for FDM Memory Issue
All -
We configured FDM to run an integration script into our EBS instance upon the import step. It worked fine for a time, then we began running out of memory on the FDM server. Upon Oracle's suggestion, we stopped running through a record set to append and update the values to strWorkTableName and instead began using INSERT INTO. I admit, I have never needed to use the INSERT INTO way of doing things so I may be missing something bery basic.
Our integration script:
Function SQLIntegration2(strLoc, lngCatKey, dblPerKey, strWorkTableName)
'Oracle Hyperion FDM IMPORT Integration Script:
'Created By: karks
'Date Created: 2011-10-26 13:05:18
'Purpose:
Dim strSQL 'SQL string
Dim lngPartitionKey
Dim strConn 'Connection string to the source data
Set cnSS = CreateObject("ADODB.Connection")
lngPartitionKey = RES.PlngLocKey
strConn= "File Name=C:\Users\karksadm\Desktop\NewConnection.udl;"
cnSS.open strConn
strSQL = "Insert Into " & strWorkTableName & " (PartitionKey, CatKey, PeriodKey, DataView, Amount , Account, Entity, ICP, UD1, UD2, UD3, UD4) "
strSQL = strSQL & "SELECT " & lngPartitionKey & ", " & lngCatKey & ", TO_DATE (TO_DATE ('30/12/1899','dd/mm/yyyy')+" & dblPerKey & "), 'YTD', EBS.YTD_BALANCE, EBS.ACCOUNT, EBS.SEGMENT1, EBS.SEGMENT5, EBS.SEGMENT4, EBS.SEGMENT5, '[None]', EBS.CURRENCY_CODE FROM "
strSQL = strSQL & "(Select D.NAME, A.CODE_COMBINATION_ID, D.NAME LEDGER_NAME, A.ACTUAL_FLAG, C.PERIOD_YEAR, TO_CHAR (C.START_DATE, 'MON-YY') AS PERIOD, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3) As ACCOUNT, B.SEGMENT4, B.SEGMENT5, A.CURRENCY_CODE, "
strSQL = strSQL & "(SUM (A.BEGIN_BALANCE_DR) + SUM (A.PERIOD_NET_DR) - SUM (A.BEGIN_BALANCE_CR) - SUM (A.PERIOD_NET_CR)) As YTD_BALANCE "
strSQL = strSQL & "FROM GL.GL_BALANCES A, GL.GL_CODE_COMBINATIONS B, GL.GL_PERIODS C, GL.GL_LEDGERS D "
strSQL = strSQL & "WHERE 1 = 1 And A.LEDGER_ID = D.LEDGER_ID And A.PERIOD_NUM = C.PERIOD_NUM And C.PERIOD_YEAR = A.PERIOD_YEAR "
strSQL = strSQL & "And A.CODE_COMBINATION_ID = B.CODE_COMBINATION_ID And B.SUMMARY_FLAG = 'N' AND C.PERIOD_SET_NAME = D.PERIOD_SET_NAME "
strSQL = strSQL & "And (B.SEGMENT1 = 001 And A.CURRENCY_CODE = 'USD' And D.LEDGER_ID = 2022) "
strSQL = strSQL & "And C.END_DATE = TO_DATE (TO_DATE ('30/12/1899','dd/mm/yyyy')+" & dblPerKey & ") "
strSQL = strSQL & "And B.CHART_OF_ACCOUNTS_ID = D.CHART_OF_ACCOUNTS_ID And A.ACTUAL_FLAG = 'A' "
strSQL = strSQL & "And ((A.BEGIN_BALANCE_DR) + (A.PERIOD_NET_DR) - ((A.BEGIN_BALANCE_CR) + (A.PERIOD_NET_CR))) <> 0 "
strSQL = strSQL & "GROUP BY A.CODE_COMBINATION_ID, D.NAME, A.CURRENCY_CODE, TO_CHAR (C.START_DATE,'MON-YY'), C.PERIOD_YEAR, A.ACTUAL_FLAG, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3), B.SEGMENT4, B.SEGMENT5 "
strSQL = strSQL & "ORDER BY B.SEGMENT4) EBS"
DW.DataManipulation.fExecuteDML(strSQL)
'Give success message
RES.PlngActionType = 2
RES.PstrActionValue = "SQL Import successful!"
'Assign Return value
SQLIntegration2 = True
cnSS.close
Set cnSS = Nothing
End FunctionI can run the SQL minus the Insert line in my SQL Developer and it works fine. When I run the script in its entirety in FDM, we receive the following:
** Begin FDM Runtime Error Log Entry [2012-01-23 11:37:30] **
ERROR:
Code............................................. -2147217865
Description...................................... ORA-00942: table or view does not exist
Insert Into tWibison72564424799 (PartitionKey, CatKey, PeriodKey, DataView, Amount , Account, Entity, ICP, UD1, UD2, UD3, UD4) SELECT 772, 28, TO_DATE (TO_DATE (N'30/12/1899',N'dd/mm/yyyy')+40724), N'YTD', EBS.YTD_BALANCE, EBS.ACCOUNT, EBS.SEGMENT1, EBS.SEGMENT5, EBS.SEGMENT4, EBS.SEGMENT5, N'[None]', EBS.CURRENCY_CODE FROM (Select D.NAME, A.CODE_COMBINATION_ID, D.NAME LEDGER_NAME, A.ACTUAL_FLAG, C.PERIOD_YEAR, TO_CHAR (C.START_DATE, N'MON-YY') AS PERIOD, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3) As ACCOUNT, B.SEGMENT4, B.SEGMENT5, A.CURRENCY_CODE, (SUM (A.BEGIN_BALANCE_DR) + SUM (A.PERIOD_NET_DR) - SUM (A.BEGIN_BALANCE_CR) - SUM (A.PERIOD_NET_CR)) As YTD_BALANCE FROM GL.GL_BALANCES A, GL.GL_CODE_COMBINATIONS B, GL.GL_PERIODS C, GL.GL_LEDGERS D WHERE 1 = 1 And A.LEDGER_ID = D.LEDGER_ID And A.PERIOD_NUM = C.PERIOD_NUM And C.PERIOD_YEAR = A.PERIOD_YEAR And A.CODE_COMBINATION_ID = B.CODE_COMBINATION_ID And B.SUMMARY_FLAG = N'N' AND C.PERIOD_SET_NAME = D.PERIOD_SET_NAME And (B.SEGMENT1 = 001 And A.CURRENCY_CODE = N'USD' And D.LEDGER_ID = 2022) And C.END_DATE = TO_DATE (TO_DATE (N'30/12/1899',N'dd/mm/yyyy')+40724) And B.CHART_OF_ACCOUNTS_ID = D.CHART_OF_ACCOUNTS_ID And A.ACTUAL_FLAG = N'A' And ((A.BEGIN_BALANCE_DR) + (A.PERIOD_NET_DR) - ((A.BEGIN_BALANCE_CR) + (A.PERIOD_NET_CR))) <> 0 GROUP BY A.CODE_COMBINATION_ID, D.NAME, A.CURRENCY_CODE, TO_CHAR (C.START_DATE,N'MON-YY'), C.PERIOD_YEAR, A.ACTUAL_FLAG, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3), B.SEGMENT4, B.SEGMENT5 ORDER BY B.SEGMENT4) EBS
Procedure........................................ clsDataManipulation.fExecuteDML
Component........................................ upsWDataWindowDM
Version.......................................... 1112
Thread........................................... 4424
IDENTIFICATION:
User............................................. ibisons
Computer Name.................................... HOU-HYSDEV02
App Name......................................... SWNFDMRC
Client App....................................... WebClient
CONNECTION:
Provider......................................... ORAOLEDB.ORACLE
Data Server......................................
Database Name.................................... FDMDEV
Trusted Connect.................................. False
Connect Status.. Connection Open
GLOBALS:
Location......................................... EBSINTEGRATION
Location ID...................................... 772
Location Seg..................................... 25
Category......................................... EBS2
Category ID...................................... 28
Period........................................... Jun - 2011
Period ID........................................ 6/30/2011
POV Local........................................ False
Language......................................... 1033
User Level....................................... 1
All Partitions................................... True
Is Auditor....................................... False
** Begin FDM Runtime Error Log Entry [2012-01-23 11:37:31] **
ERROR:
Code............................................. -2147217865
Description...................................... Data access error.
At line: 33
Procedure........................................ clsImpProcessMgr.fExecuteImpScript
Component........................................ upsWObjectsDM
Version.......................................... 1112
Thread........................................... 4424
IDENTIFICATION:
User............................................. ibisons
Computer Name.................................... HOU-HYSDEV02
App Name......................................... SWNFDMRC
Client App....................................... WebClient
CONNECTION:
Provider......................................... ORAOLEDB.ORACLE
Data Server......................................
Database Name.................................... FDMDEV
Trusted Connect.................................. False
Connect Status.. Connection Open
GLOBALS:
Location......................................... EBSINTEGRATION
Location ID...................................... 772
Location Seg..................................... 25
Category......................................... EBS2
Category ID...................................... 28
Period........................................... Jun - 2011
Period ID........................................ 6/30/2011
POV Local........................................ False
Language......................................... 1033
User Level....................................... 1
All Partitions................................... True
Is Auditor....................................... False
** Begin FDM Runtime Error Log Entry [2012-01-23 11:37:31] **
ERROR:
Code............................................. -2147217865
Description...................................... Data access error.
At line: 33
Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
Component........................................ upsWObjectsDM
Version.......................................... 1112
Thread........................................... 4424
IDENTIFICATION:
User............................................. ibisons
Computer Name.................................... HOU-HYSDEV02
App Name......................................... SWNFDMRC
Client App....................................... WebClient
CONNECTION:
Provider......................................... ORAOLEDB.ORACLE
Data Server......................................
Database Name.................................... FDMDEV
Trusted Connect.................................. False
Connect Status.. Connection Open
GLOBALS:
Location......................................... EBSINTEGRATION
Location ID...................................... 772
Location Seg..................................... 25
Category......................................... EBS2
Category ID...................................... 28
Period........................................... Jun - 2011
Period ID........................................ 6/30/2011
POV Local........................................ False
Language......................................... 1033
User Level....................................... 1
All Partitions................................... True
Is Auditor....................................... False
I really think the issue is that I am not telling the script where to find the Oracle tables at. I left the code in where we were using the UDL to call in the opening of the record set, but since we are doing away with the record set how do I let FDM know where to find the Oracle tables?
Thanks in advance - I've been wrestling with this for several days.
Thanks you,
SarahHere's a script with INSERT INTO that works fine if FDM back-end is SQL DB and it's pulling from FDMHarris data warehouse which is on SQL Server.
Problem is when FDM back-end is Oracle DB and it's pulling from FDMHarris data warehouse which is on SQL Server.
I'm assuming the INSERT INTO statement needs to be written differently, syntax wise?
Here's the error message displayed.
** Begin FDM Runtime Error Log Entry [2012-06-03 21:18:15] **
ERROR:
Code............................................. -2147217900
Description...................................... ORA-00933: SQL command not properly ended
INSERT INTO tWadmin476032843931 (PartitionKey, CatKey, PeriodKey, DataView, CalcAcctType, Entity, Account, UD1, UD2, UD4, Amount) SELECT 752, 12, N'30-Apr-2012', N'YTD', 9, Entity, Account, UD1, UD2, UD4, Amount FROM FDMHarris.dbo.tdataseg4;
Procedure........................................ clsDataManipulation.fExecuteDML
Component........................................ upsWDataWindowDM
Version.......................................... 1112
Thread........................................... 3284
Function INSERTINTO(strLoc, lngCatKey, dblPerKey, strWorkTableName)
'Oracle Hyperion FDM IMPORT Integration Script:
'Created By: admin
'Date Created: 2012-06-03 11:31:39
'Purpose:
Dim objSS 'ADODB.Connection
Dim strSQL 'SQL String
Dim rs 'Recordset
Dim rsAppend 'tTB table append rs Object
Dim strPeriod
Dim strYear
'Period
'strPeriod=MonthName(Month(RES.PdtePerKey))
a=CStr(FormatDateTime(RES.PdtePerKey,1))
'Tuesday,January 30, 2012
b=Right(a,(Len(a)-Len(DW.Utilities.fParseString(a,1,1,",")))) '7
c=DW.Utilities.fParseString(b,2,2,",")
strPeriod=Left(c,3)
'Year
'strYear=Year(RES.PdtePerKey)
strYear=Right(b,4)
DW.DBTools.mLogError 1, CStr(strPeriod), CStr(strYear), Nothing
'Initialize objects
Set cnSS = CreateObject("ADODB.Connection")
'Connect To SQL Server database
cnss.open "Provider=SQLOLEDB.1;Password=datafusion;Persist Security Info=True;User ID=sa;Initial Catalog=FDMHarris;Data Source=dfv11122"
'DW.DBTools.mLogError 1, CStr(strSQL), CStr(strSQL), Nothing
'Initialize common SQL statement
strSQL = "INSERT INTO " & _
strWorkTableName & " " & _
"(PartitionKey, CatKey, PeriodKey, DataView, CalcAcctType, Entity, Account, UD1, UD2, UD4, Amount) " & _
"SELECT " & RES.PlngLocKey & ", " & RES.PlngCatKey & ", " & _
"'" & Day(RES.PdtePerKey) & "-" & MonthName(Month(RES.PdtePerKey), True) & "-" & Year(RES.PdtePerKey) & "', " & _
"'YTD', 9, Entity, Account, UD1, UD2, UD4, Amount " & _
"FROM FDMHarris.dbo.tdataseg4;" '& _
' "WHERE Month = '" & strPeriod & "' And CalYear = '" & strYear & "'"
DW.DBTools.mLogError 1, CStr(strSQL), CStr(strWorkTableName), Nothing
DW.DataManipulation.fExecuteDML(strSQL)
'cnss.Execute strSQL
'Records loaded
RES.PlngActionType = 6
RES.PstrActionValue = "SQL Import successful!"
'Assign Return value
INSERTINTO = True
cnss.Close
Set cnss = Nothing
End Function
Edited by: user12152138 on Jun 3, 2012 6:43 PM -
Insert into - commit_form - records disapears
Hi folks;
I 'm working with Forms6i and Oracle 9i r2 database.
I got a problem on a table T_ENV, it's an session environnement table where I store informations about the login_name, id_session and else...
When a user is log to the application (trigger WHEN_NEW_FORM_INSTANCE) , a new row is created in T_ENV.
GO_BLOCK ('T_ENV');
select userenv('sessionid') into :ENV_SESSION.ID_SESSION;
select sysdate into :env_session.date_session
:env_session.nom_login := :global.nom_user;
insert into T_ENV values (:env_session.id_session,:env_session.date_session,etc...);
commit_form;I have research all the "CLEAR_BLOCK('T_ENV')" and "DELETE FROM T_ENV" commands and comments it.
So I want to know why, after 10-15 minutes, the new records in the table T_ENV disappears (were deleted) ?
Is it done by a paramter of the database ?
How to debug the "commit_form" command ?
Thanks for any help, regards.Yes, I meant "insert into" statement in your when-new-form-instance trigger.
You have block T_ENV. If this block based on t_env table and you assign values to the items of this block, forms will issue additional insert statement during commit.
But.., if you can see record from another session - this is not the case. Most likely you are deleting record somewhere else.
Search forms for "delete_record" or "delete from t_env".
May be you have some database job, or database trigger that deletes from t_env -
Customized Insert into Command
Dear All,
Here, I want to make a SQL script to do an INSERT INTO Statement from TABLE “A” to “B” like this
Insert into A select * from B
But catch is that – TABLE “A” is having e 4 extra columns(Year, Month, Week, Day), those not exists in TABLE “B”, & due to this Plain INSERT INTO statement is not working.
Therefore, I want to create a dynamic INSERT INTO command with skip of 4 said columns.
You can better understand this in this way..
My Desired.
Insert into A ( Id,Name,Address,City,Zip)
select Id,Name,Address,City,Zip from B
Please Help !
Thanks..Hi Visakh16,
Sorry for my earlier remark I was unclear.
Actually Error message is like this ..
Msg 512, Level 16, State 1, Line 4
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
If I’m executing this piece of code..
DECLARE @SQl varchar(max)
SELECT @SQL = 'INSERT A (' +
STUFF(
(SELECT ',' + COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = t.TABLE_NAME
AND TABLE_SCHEMA = t.TABLE_SCHEMA
),1,1,'') + ')
SELECT ' +
STUFF(
(SELECT ',' + COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = t.TABLE_NAME
AND TABLE_SCHEMA = t.TABLE_SCHEMA
),1,1,'') + ' FROM ' + TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES as t
WHERE TABLE_NAME = 'Sale2013'
--print @SQL
EXEC (@SQL)
Please help me to diagnose this .. -
Hi,
I'm new to coldfusion and was doing a practice survey. I'm
getting the following error:
The INSERT INTO statement contains the following unknown
field name: 'recipes'. Make sure you have typed
the name correctly, and try the operation again.
The error occurred in (coldfusion form): line 405
403 :
(lname,fname,yourID,status,preprog_survey,recipes,activity,tips,stress,other,othertext,we ight_result,lbs_gained,lbs_lost,behaviors,desc_behaviors,most_help,improve_prog)
404 : values
405 :
('#lname#','#fname#','#yourID#','#status#','#preprog_survey#','#recipes#','#activity#','# tips#','#stress#','#other#','#othertext#','#weight_result#','#lbs_gained#','#lbs_lost#','# behaviors#','#desc_behaviors#','#most_help#','#improve_prog#')
406 : </cfquery>
407 :
SQL Insert into maintaint
(lname,fname,yourID,status,preprog_survey,recipes,activity,tips,stress,other,othertext,we ight_result,lbs_gained,lbs_lost,behaviors,desc_behaviors,most_help,improve_prog)
values ('last name','first
name','444444','member,'No','0','0','1','0','1','no work, all
play','gained',' too many','','Yes','Dreaming of eating better, but
not doing it','This survey!','no improvement suggestions'
VENDORERRORCODE -3502
SQLSTATE 42000
Can anyone tell me what this possibly means? I'm sure its
probably hard to understand without seeing the form. These are the
types of fields each are:
lname, fname, yourID = text
status = radio
preprog_survey = radio
recipes, activity,tips, stress, other, = checkboxes
othertext, = text
weight_result, = radio
lbs_gained,lbs_lost, = text
behaviors, = radio
desc_behaviors, most_help, improve_prog = textLooking at the code you supplied I noticed that for the
checkboxes values where '0' and '1'.
SQL Insert into maintaint
(lname,fname,yourID,status,preprog_survey,recipes,activity,tips,stress,other,othertext,we ight_result,lbs_gained,lbs_lost,behaviors,desc_behaviors,most_help,improve_prog)
values ('last name','first
name','444444','member,'No','0','0','1','0','1','no work, all
play','gained',' too many','','Yes','Dreaming of eating better, but
not doing it','This survey!','no improvement suggestions'
You don't need quotes around numeric values, only text.
Hope that helps you. -
Syntax eror in INSERT INTO satement
I get this when i try to insert information in the database:
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
thanks for the help in advancedEpid3mik
> I get this when i try to insert information in the
database:
I suspect some of your column names are reserved keywords,
such as FROM, TIME, etcetera.
http://support.microsoft.com/kb/286335
Whenever possible, avoid using keywords as object names. The
better solution here is to permanently rename the columns that are
keywords. Assuming the rest of your query syntax is correct, that
should fix the syntax error. If for some reason you cannot rename
the columns, you must escape them by using square brackets around
the column names:
INSERT INTO Message ( mem_id, [From], [Time], .... )
As an aside, you should properly scope your variables.
Example use #FORM.mem_id# instead of just #mem_id#. Your should
also consider using cfqueryparam for all query values. These last
two things are not the cause of your error, but they are good
coding practices. -
Dear sirs,
please i want to write code inside button on form, this code for insert into table, and i want to write commit_form, but before execute always give me message, is there syntax for make commit after insert into
known that i use form 6i
best regards for all
YasserYasser,
I can't understand what you mean by but before execute always give me message,
And to write insert into statements in form, its better to use FORMS_DDL built-in, because, by this, we can commit the database without commiting the form.
FORMS_DDL('<insert into statement>');
FORMS_DDL('COMMIT');Regards,
Manu.
If my response or the response of another was helpful or Correct, please mark it accordingly
Maybe you are looking for
-
Initial entry of stock balance
hi everbody what will be the account posting in case 1) of initial entry of stock balance 2) of gr witout reference to po (mvt type 501) in both case raw material account is hitting with transaction key bsx posting key 89 then what will be secind acc
-
Photoshop CS reloading and activation problems
I have upgraded my operating software from Windows XP to Win7 but when reloading my Photoshop CS using the original disc and registration number, when the programme starts it requires an activation procedure. My online attempts to activate give me t
-
Iphone 3.0 reminder feature?
does anyone know if the iphone 3.0 software will include a reminder feature for missed calls or text messages. i recently purchased an iphone and am missing a ton of calls and text messages. due to my work environment i must have my phone set to vibr
-
Is there a way to embed a pic in all emails
I would like to add a small pic in the beginning of my written emails? Is there a way to do this? Am tired of adding to each one that I want it included. Any ideas?
-
Kill Session option is not rac aware?
Connected to a RAC db, tried to kill session but SD kept complaining that session doesn't exist. It seems it shows sessions from gv$session but while issuing kill, it assumes session on local node. Would it not be possible to enhance the kill to use