Syntax errors using sql and java
Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:
INSERT INTO table_name(column_name, ..., column_name)
VALUES(value, ..., value)
However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
String query = " INSERT INTO SESSIONS (" +
"id,module_name, module_number, level, session " +
"term, class_list, location, lecturer" + ")
VALUES('"+
fields.id.getText() + "', '"+
fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
fields.level.getText() + "', '" fields.session.getText() "', '" +
fields.term.getText() + "', '" fields.class_list.getText() "', '" +
fields.location.getText() + "', '" fields.lecturer.getText() "')";
output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");
output.append( "query sent");
thanks
int result = statement.executeUpdate(query);
With all those quotes and apostrophes and string concatenations, I'd be surprised if you got it right by the fourth try. (By the way, you appear to have missed a comma between "session" and "term".) Are you planning to insert more than one record in your program? If so, you should consider using a PreparedStatement. This will likely run faster, and your program will definitely be easier to read. Also, you won't have to come back here later to ask how you deal with data that includes apostrophes (the notorious "O'Brien" problem). Here's how you do that... you define the PreparedStatement only once:
String query =
"INSERT INTO SESSIONS (id,module_name, module_number, level, session, term, class_list, location, lecturer) " +
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement insert = connection.prepareStatement(query);and then every time you want to insert a record you do this:
insert.setString(1, fields.id.getText());
insert.setString(2, fields.module_name.getText());
// and so on...
insert.executeQuery();
Similar Messages
-
What is the diffrence between package javax.sql and java.sql
Is javax designed for J2EE?
And when to use package javax?Hi,
What is the diffrence between package javax.sql and java.sql?The JDBC 2.0 & above API is comprised of two packages:
1.The java.sql package and
2.The javax.sql package.
java.sql provides features mostly related to client
side database functionalities where as the javax.sql
package, which adds server-side capabilities.
You automatically get both packages when you download the JavaTM 2 Platform, Standard Edition, Version 1.4 (J2SETM) or the JavaTM 2, Platform Enterprise Edition, Version 1.3 (J2EETM).
For further information on this please visit our website at http://java.sun.com/j2se/1.3/docs/guide/jdbc/index.html
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Micro Systems
http://www.sun.com/developers/support/ -
Adpatch: Error running SQL and EXEC commands in parallel
Hi
I am applying R12 RUP2 to an instance at the moment. I had an OS crash (I'm running R12 on Linux on VMWARE) and on reboot attempted to restart the patch.
I now get an error as follows:
Error running SQL and EXEC commands in parallel
I must admit, I'm not a DBA, so if anyone has any ideas or has seen this before then it would be most appreciated!
Thanks
ChrisHi Adith
The patch is 5484000, RUP 2 for E-Business Suite R12
Here's the adpatch output:
Start date: Wed Sep 12 2007 15:15:14
0 "left over" javaupdates.txt files uploaded to DB: Wed Sep 12 2007 15:15:14
0 patches uploaded from the ADPSV format patch history files: Wed Sep 12 2007 15:15:14
Uploading information about files copied during the previous runs ...
0 "left over" filescopied_<session_id>.txt files uploaded to DB: Wed Sep 12 2007 15:15:14
****************** E N D O F U P L O A D ******************
End date: Wed Sep 12 2007 15:15:14
Already asked for the name of the patch directory.
(The answer was: /oracle/patches/5484000)
Already asked for the name of the patch driver file.
(The answer was: /oracle/patches/5484000/u5484000.drv)
Reading release list save file...
Done reading release list save file
Log and Info File sync point:
Wed Sep 12 2007 15:15:15
Turning off actions that reference unrecognized products.
Log and Info File sync point:
Wed Sep 12 2007 15:15:15
End of unrecognized products checking.
(The number of parallel workers is: " 2 ")
AutoPatch will run in parallel mode.
Did not need to apply new applterr.txt.
Skipping...
Determine directories to create for Specified driver
since no such action is present for this driver file
Skipping...
Determine Oracle Reports libraries to generate for Specified driver
since no such action is present for this driver file
Skipping...
Determine if need to generate message files for Specified driver
since no such action is present for this driver file
Skipping...
Create Directories for Specified driver
since no such action is present for this driver file
Number of invalid objects: 31057
Running SQL scripts and EXEC commands...
Determining which SQL and EXEC commands to run...
Validating PL/SQL direct execute exceptions file ...
Done validating PL/SQL direct execute exceptions file.
SERVICE_NAME/INSTANCE_NAME : [VIS]
connect_string : [(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ebusr12.chriseebee.me.uk)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=VIS)))]
Done determining which SQL and EXEC commands to run.
Running SQL and EXEC commands in parallel...
Creating the AD_UTIL_PARAMS table...
Table AD_UTIL_PARAMS already exists, so dropping the table and recreating it.
Creating FND_INSTALL_PROCESSES table...
Already created fnd_install_processes table
Already created FND_INSTALL_PROCESSES_U1 index.
Already created AD_DEFERRED_JOBS table
Already created AD_DEFERRED_JOBS_U1 index.
Writing dependencies of jobs to run to appldep.txt file...
There are now 7569 jobs remaining (current phase=A0):
0 running, 5 ready to run and 7564 waiting.
Reading completed jobs from restart file (if any).
There are now 3474 jobs remaining (current phase=A18):
0 running, 1 ready to run and 3473 waiting.
Determining which java executables are supported by adJavaWorker...
Starting worker processes.
Worker process 1 started.
Worker process 2 started.
Checking if all jobs have their actual and symbolic arguments in sync....
Done.
Writing jobs to run to restart file.
Reading jobs from FND_INSTALL_PROCESSES table ...
Running: file adobjcmp.sql on worker 1 for product ad username APPLSYS.
AutoPatch error:
The worker should not have status 'Running' or 'Restarted' at this point.
Telling workers to quit...
************* Start of AD Worker session *************
AD Worker version: 12.0.0
AD Worker started at: Wed Sep 12 2007 15:15:34
APPL_TOP is set to /oracle/VIS/apps/apps_st/appl
************* Start of AD Worker session *************
AD Worker version: 12.0.0
AD Worker started at: Wed Sep 12 2007 15:15:34
APPL_TOP is set to /oracle/VIS/apps/apps_st/appl
All workers have quit.
AutoPatch error:
Error running SQL and EXEC commands in parallel
You should check the file
/oracle/VIS/apps/apps_st/appl/admin/VIS/log/adpatch.log
for errors. -
Error running SQL and EXEC commands in parallel
Dear Gurus,
We are applying 3480000 and in process as soon as workers start it come out of adpatch session and give su the following error:
************* Start of AD Worker session *************
AD Worker version: 11.5.0
AD Worker started at: Sun Sep 02 2007 23:11:01
APPL_TOP is set to /sgmtemp/prodappl
Worker process 4 started.
Checking if all jobs have their actual and symbolic arguments in sync....
Done.
Writing jobs to run to restart file.
Reading jobs from FND_INSTALL_PROCESSES table ...
Done reading jobs from FND_INSTALL_PROCESSES table ...
Telling workers to read 'todo' restart file.
Done.
Starting phase 0 (A0): first
There are now 98197 jobs remaining (current phase=A0):
0 running, 123 ready to run and 98074 waiting.
Assigned: file adsysapp2.sql on worker 1 for product admin username APPLSYS.
Assigned: file cssruwq1.sql on worker 2 for product cs username CS.
Connecting to CSD......Unable to connect.
AutoPatch error:
The following ORACLE error:
ORA-01017: invalid username/password; logon denied
occurred while executing the SQL statement:
CONNECT CSD/*****
AutoPatch error:
Error while evaluating "Check Object"
Telling workers to quit...
3 workers have quit. Waiting for 1 more.
All workers have quit.
Error running SQL and EXEC commands in parallel
You should check the file
/sgmtemp/prodappl/admin/msbep004/log/3480000_sbm3.log
for errors.
applmgr@21:/sgmtemp/Oglupgr/3480000>
What could be the issue, i tried to connect CSD/CSD in sql and it connected.
Thanks in Advance
Regards
Kiran RanaHi Gurus,
Even i tried to recreate the FND_GLOBAL by performing the following, but still no luck:
output for scripts hearder value in FND_TOP:
applmgr@21:/sgmtemp/prodcomn/temp> cd $FND_TOP/patch/115/sql
applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql> grep Header AFSCGBL*
AFSCGBLB.pls:/* $Header: AFSCGBLB.pls 115.78 2005/03/21 11:40:02 vbalakri ship $ */
AFSCGBLS.pls:/* $Header: AFSCGBLS.pls 115.33 2004/06/30 05:00:18 rsheh ship $ */
Output for script header value in Database:
SQL> select text from dba_source where name='FND_GLOBAL' and line <5;
TEXT
package FND_GLOBAL as
/* $Header: AFSCGBLS.pls 115.33 2004/06/30 05:00:18 rsheh ship $ */
package body FND_GLOBAL as
/* $Header: AFSCGBLB.pls 115.78 2005/03/21 11:40:02 vbalakri ship $ */
8 rows selected.
We tried to re-apply 4 hours back when one of the support personnal ask use to run those
scripts. one of them went with out any errors but second one went with errors
as follows:
First Script @AFSCGBLS.pls
applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql> sapps @AFSCGBLS.pls
SQL*Plus: Release 8.0.6.0.0 - Production on Mon Sep 3 03:24:10 2007
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
DOC> | Copyright (c) 1993 Oracle Corporation Redwood Shores, California, USA|
DOC> | All rights reserved. |
DOC> +=======================================================================+
DOC> | FILENAME
DOC> | AFSCGBLS.pls
DOC> |
DOC> | DESCRIPTION
DOC> | PL/SQL specification for package: FND_GLOBAL
DOC> |
DOC> | NOTES
DOC> | This module is called by AutoInstall (afplss.drv) on install and
DOC> | upgrade. The WHENEVER SQLERROR and EXIT (at bottom) are required.
DOC> |
DOC> | HISTORY
DOC> | June, 1999 - Added function AUDIT_ACTIVE, bug 879630. Jan Smith.
DOC> | 11/19/01 MSkees - Added DBDrv line and 'SET VERIFY OFF' for ARU auto
DOC> | generation bug 2047263 build
DOC> |
DOC> *=======================================================================*/
Package created.
Commit complete.
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
Second Script AFSCGBLB.pls:
applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql> sapps @AFSCGBLB.pls <
SQL*Plus: Release 8.0.6.0.0 - Production on Mon Sep 3 03:27:15 2007
(c) Copyright 1999 Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
Warning: Package Body created with compilation errors.
Commit complete.
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.7.0 -
Production
applmgr@21:/sgmtemp/prodappl/fnd/11.5.0/patch/115/sql>
The second script (AFSCGBLB.pls) run's out with errors and changes status of almost 15000 objects as INVALID in database.
Regards
Kiran Rana -
Importing/Parsing XML using SQL and/or PL/SQL
What is the recomended way of importing/parsing XML data using SQL and/or PL/SQL?
I have an XSD that defines the structure of the file, and an XML file that has the content in the appropriate structure. I have parsed (checked) the structure of the XML file using JDOM in my java application, and then passed it to a function in a package on the database as a CLOB.
What I need to do is parse the contents of the XML file that is passed into the function and extract the values of each XML element so that I can then do some appropriate validation before inserting and committing the data to the database (hence completing the import function).
A DBA colleague of mine has been experimenting with various ways of acheiving this, but has encountered a number of problems along the way, one of which being that he thinks that it is not possible to parse XML elements that are nested more than four levels deep - is this the case?
The structure of the XSD/XML that the database function needs to manipulate and import data from is very complex (and recursive by it's nature).
I would appreciate any suggestions as to how I can achieve the above in the most efficient manner.
Thanks in advance for your help
DavidThis is the forum for the SQLDeveloper tool. You will get better answers in the SQL and PL/SQL forum, and especially the XML DB forum.
Oracle has comprehensive and varied support for XML, including a PL/SQL parser. -
Simple XML to Text onversion using XSLT and Java?
Hi all!
I'm completly new to using XSLT and Java and are trying to convert a XML file into a ordinary Textfile that I am gonna import into another application.
I started up writing a ordinary XML parser in Java which interpreted the XML file, but realized later on that it was possible to do with a ordinary XSLT.
So far it is a 2-step process right now, I've tied my XSLT to the XML file and then just open the XML file up in a ordinary browser and then get the result.
I found an example (http://www.onjava.com/pub/a/onjava/excerpt/java_xslt_ch5/index.html?page=3) where u hook up a XML file and a XSL file separately and the process it, and dump it to Stdout. But do I need to hook up a XSL file like this when the XML file is tied to a XSL file internally?Just to give you an example to show you how easy it is: http://www.daniweb.com/forums/thread137587.html
-
Information Retrieval with Genetic Programming using J2ME and Java WTK
i have a big project to make a software using java programming especially n using J2ME and Java Wireless Toolkit, and i'm a begginer for java programming. I have no idea for the interface and how to setting connection between my phone mobile and GPRS. what should i do? thank you
I believe MIT has lots of sourcecode. Try searching their site.
-
Not able to recognize any video/audio devices using jmf and java soun
Hi ,
I need one help from your side.
Here I am expecting some clarifications from you. Before that let you my environement.
My working environment :
Eclipse tool and added jmf jar to my project I did not do any thing more.
If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
Please bare with my questions.
1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
Do we need any administrives rights for our working PC.
What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
( like for TragetdataLine ...i,e, all ports are getting false)
I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
Can you explain the reasons ? I gone through API but i am not clear.
HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
Thanks
RamaRao.GHi ,
I need one help from your side.
Here I am expecting some clarifications from you. Before that let you my environement.
My working environment :
Eclipse tool and added jmf jar to my project I did not do any thing more.
If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
Please bare with my questions.
1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
Do we need any administrives rights for our working PC.
What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
( like for TragetdataLine ...i,e, all ports are getting false)
I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
Can you explain the reasons ? I gone through API but i am not clear.
HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
Thanks
RamaRao.G -
Error running SQL and EXEC commands in parallel when adpatch
Hi,
AutoPatch error:
aiprfp: product 'cle' not in release 'R120'
AutoPatch error:
Error running SQL and EXEC commands in parallel
Freeing includes hash table
Freeing fixes hash table
Freeing basedons hash table
Freeing entities hash table
You should check the file
/a02/prod/apps/apps_st/appl/admin/PROD/log/adpatch_7305220_1.log
for errors.
How to resolve this errror while applying patch 7305220.
Regards,Hi,
Please check logfile */a02/prod/apps/apps_st/appl/admin/PROD/log/adpatch_7305220_1.log* for any errors recoded.
Post error messages from this logfile.This is the main patch log file and it should show the same error "aiprfp: product 'cle' not in release 'R120'".
Thanks,
Hussein -
RQL Error - JQuery Datepicker and java.sql.Timestamp
Hello everyone,
I am using JQuery Datepicker to select start and end date range.
Both start date and end date are successfully passed as like this. 10/01/2013 and 10/31/2013
It has java.sql.Timestamp mapping in both startDate and endDate.
Property name in component browser is transactionTimestamp.
It gives me following error when i passed both parameters.
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
<dsp:param name="repository" value="/atg/commerce/order/OrderRepository" />
<dsp:param name="itemDescriptor" value="inStorePaymentStatus" />
<dsp:param name="queryRQL" value="transactionTimestamp>=:startDate AND transactionTimestamp<:endDate" />
**** Error Wed Oct 02 16:07:21 IST 2013 1380710241490 /atg/dynamo/droplet/RQLQueryForEach unable to parse/execute query due to RepositoryException CONTAINER:atg.repository.RepositoryException; SOURCE:java.sql.SQLException: java.sql.SQLDataException: ORA-01843: not a valid month
It gives NO error when i passed single parameter.
<dsp:param name="queryRQL" value="transactionTimestamp>=:startDate"/>
can anyone suggest me a solution.
Thanks
saminda konkaduwaHi all,
Found the solution. We have to use parameter converter tools as well. that is the additional parameter called "date" where we passed date format.
<dsp:param name="startDate" param="10/12/2012" date="MM/dd/yyyy"/>
<dsp:param name="endDate" param="10/12/2015" date="MM/dd/yyyy"/>
Explanation :
JSP FILE ( testing.jsp)
=================
<dsp:page>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="merchant_portal_ajax_agent_report.js"></script>
<script type="text/javascript">
$(function() {
$("#startDate").datepicker();
$(function() {
$("#endDate").datepicker();
</script>
</head>
<body>
<table>
<tr>
<td>Start Date</td>
<td><input type="text" id="startDate" class="picker" name="sDate" /></td>
<td>End Date</td>
<td><input type="text" id="endDate" class="picker" name="sDate" /></td>
<td><input value="Find" type="submit" class="atg_button" onclick="loadAgentReport()" /></td>
</tr>
<tr>
<div id="agentReportTable"></div>
</tr>
</table>
</body>
</dsp:page>
JAVA SCRIPT FILE (merchant_portal_ajax_agent_report.js)
============================================
function loadAgentReport() {
var startDateValue = $("#startDate").val();
var endDateValue = $("#endDate").val();
$(document).ready(function() {
$.ajax({
type : "POST",
url : "merchant_portal_view_agent_report.jsp",
data : {
startDate : "" + startDateValue + "" , endDate : "" + endDateValue + ""
success : function(result) {
$("#agentReportTable").html("");
$("#agentReportTable").html(result);
JSP File ( This invoked by Jquery ) merchant_portal_view_agent_report.jsp
=======================================================
<dsp:page>
<dsp:droplet name="/atg/dynamo/droplet/RQLQueryForEach">
<dsp:param name="repository" value="/atg/commerce/order/OrderRepository" />
<dsp:param name="itemDescriptor" value="inStorePaymentStatus" />
<dsp:param name="queryRQL" value="agentId=:agentId AND transactionTimestamp>:startDate AND transactionTimestamp<:endDate" />
<dsp:oparam name="output">
<dsp:valueof param="element.transactionId"/> <dsp:valueof param="element.transactionStatus"/>
</br>
</dsp:oparam>
<dsp:oparam name="empty">
No data found
</dsp:oparam>
</dsp:droplet>
</dsp:page>
Thanks
saminda konkaduwa -
MOF Syntax Error Installing SQL Server 2014 Express
I am trying to install SQL Server 2014 Express With Tools on a fully updated Win 8.1 system having already installed Visual Studio Community 2013 with Update 4. During the installation of SQL Server, I am getting a "MOF Syntax Error".
I found this http://support.microsoft.com/kb/2387686 on the web but I can't see that that applies to me as I would have thought that any suggested fixes from this article would have been already installed
or corrected in Win 8.1 or SQL Server 2014. Neither do I know what fix I should install anyway.
An entry on this forum suggested that running Winmgmt /salvagerepository command fixed the problem. I ran the command in the Command Prompt and a /verifyrepository said it was consistent. However, the error still occurred when I installed SQL Server.
Can anyone help with this?Hi wagham,
From your description, you encounter the error when installing SQL Server 2014 Express on Windows 8.1. For further analysis, please help to post the summary and detail logs which locate under
%ProgramFiles%\Microsoft SQL Server\120\Setup Bootstrap\Log. For more details about viewing SQL Server setup log files, you can refer to this
article.
Additionally, based on my research, “MOF Syntax Error” could be caused by various reasons, such as insufficient account permissions, corrupted .NET Framework and so on. There are some proposals for you installing SQL Server 2014 Express as follows.
1. Make sure that the account you use to install SQL Server has admin rights. If you are using a domain administrator, please ensure that it is added to local administrator group.
2. Make sure that you right-click the SQL Server setup file (setup.exe) and choose “Run as administrator” to complete the installation.
3. Check that if the .NET Framework is corrupted on your system. You can verify the installation state of the .NET Framework via the
.NET Framework Setup Verification Tool. If the .NET Framework is corrupted, please
repair it using
.NET Framework Repair Tool, then reinstall SQL Server.
Here is a similar blog about “MOF Syntax Error” for your reference.
http://sqlservertimes2.com/?p=641
Thanks,
Lydia Zhang -
Help! Syntax Error in SQL statement
Hello. I'm getting an error message and I'm just not seeing
where I went wrong. The SQL statement is:
updateSQL = "UPDATE TrainingHistory SET Status='" &
fFormat(Request.Form(cStatus)) & "', StatusComments='" &
fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
& fFormat(Request.Form(cTrainingID))
The error message is:
[Microsoft][ODBC Microsoft Access Driver] Syntax error in
string in query expression '' WHERE Training_ID=9054'.
I've been looking at it for a while. Not sure where I went
wrong. Here is a more complete version of the code:
<%
Function fFormat(vText)
fFormat = Replace(vText, "'", "''")
End Function
Sub sRunSQL(vSQL)
set cExecute = Server.CreateObject("ADODB.Command")
With cExecute
.ActiveConnection = MM_coldsuncrea_lms_STRING
.CommandText = vSQL
.CommandType = 1
.CommandTimeout = 0
.Prepared = true
.Execute()
End With
End Sub
If Request.Form("action")="update" Then
'Set variables for update
Dim updateSQL, i
Dim cTrainingID, cStatus, cStatusComments
'Loop through records on screen and update
For i = 1 To fFormat(Request.Form("counter"))
'Create the proper field names to reference on the form
cTrainingID = "Training_ID" & CStr(i)
cStatus = "Status" & CStr(i)
cStatusComments = "StatusComments" & CStr(i)
'Create the update sql statement
updateSQL = "UPDATE TrainingHistory SET Status='" &
fFormat(Request.Form(cStatus)) & "', StatusComments='" &
fFormat(Request.Form(cStatusComments)) & " WHERE Training_ID="
& fFormat(Request.Form(cTrainingID))
'Run the sql statement
Call sRunSQL(updateSQL)
Next
'Refresh page
Response.Redirect("ClassUpdateRoster.asp?Training_ID=") &
(rsClassDetails.Fields.Item("event_ID").Value)
End If
%>You need another single quote after the double quote before
the WHERE clause. You are not closing the single quote you used to
delimit the value for StatusComments. -
ODI 10.1.3.4.0 - Topology Manager Connection Error using SQL 2005 SP3
Hello All,
I am using the ODI repository in SQL 2005 SP3. I could create my master repository using the following parameters:
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
URL:jdbc:microsoft:sqlserver://server_name:1433;SelectMethod=direct;DataBaseName=ODI
I needed to copy to the drivers directory all files of SQL 2000 (msutil.jar, msbase.jar,mssqlserver.jar) and SQL 2005 (sqljdbc.jar). I am using the JRE 1.4.2 and JDBC 2005 1.2 (http://msdn.microsoft.com/en-us/library/ms378422(SQL.90).aspx)
But when I try to connect in Topology Manager to create the work repository appears the following error:
using this driver string: com.microsoft.jdbc.sqlserver.SQLServerDriver
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC] Can't start a cloned connection while in manual transaction mode.
using this driver string: com.microsoft.sqlserver.jdbc.SQLServerDriver
java.sql.SQLException: No suitable driver
Does Somebody know what is happening?
Regards,
Wallace Galvao
Sao Paulo - BrazilHi,
If you plan on using the SQL Server 2005 drivers then you only need the 1.2 sqljdbc.jar file in the drivers directory.
The connection details for SQL Server 2005 should be like the following.
com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc:sqlserver://<sqls machine>:1433;databaseName=<db name>;integratedSecurity=false
I would try just with just the correct driver in place, remove the others, restart any ODI components and then make sure the connection information is correct like above.
Cheers
John
http://john-goodwin.blogspot.com/ -
Syntax error using try statement in WLST
Hi All,
I have a WLST script to create some JMS resources.
I want to implement exception handling in such a way that if the script fails at any point, all the changes done should be reverted back.
However, whenever I am trying to put a try block, the script is throwing syntax error on the first line after the try statement.
Please find below the script I am using. Please suggest
import sys
from java.lang import System
*# Putting a try statement here results in a syntax error at the below line*
print "Starting the script ..."
connect('weblogic',password,'t3://osbdev:7001')
edit()
startEdit()
servermb=getMBean("Servers/osb_server")
if servermb is None:
print 'Value is Null'
else:
+# Creating the JMS Server+
jmsserver1mb = create('WLSTJMSServer','JMSServer')
jmsserver1mb.addTarget(servermb)
+# Creating the JMS Module+
jmsMySystemResource = create("WLSTJmsSystemResource","JMSSystemResource")
jmsMySystemResource.addTarget(servermb)
subDep1mb = jmsMySystemResource .createSubDeployment('WLSTJMSSubDeployment')
subDep1mb.addTarget(jmsserver1mb)
theJMSResource = jmsMySystemResource.getJMSResource()
connfact1 = theJMSResource.createConnectionFactory('WLSTConnFact1')
connfact1.setJNDIName('jms.WLSTConnFact1')
connfact1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue1..."
jmsqueue1 = theJMSResource.createQueue('WLSTJMSQueue1')
jmsqueue1.setJNDIName('jms.WLSTJMSQueue1')
jmsqueue1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue2..."
jmsqueue2 = theJMSResource.createQueue('WLSTJMSQueue2')
jmsqueue2.setJNDIName('jms.WLSTJMSQueue2')
jmsqueue2.setSubDeploymentName('WLSTJMSSubDeployment')
*# try statement is working at only this point of the program*
try:
save()
activate(block="true")
print "script returns SUCCESS"
except:
save()
cancelEdit(defaultAnswer="y")
print "Error while trying to connect to server !!!"
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()
raise
Edited by: Chintan Parekh on Mar 16, 2011 7:06 AMHi Chintan,
Try doing copy pasting the below code, you have to hit the tab or space after try or except to create its block and keep an eye on the alinement's of it.
try:
save()
activate(block="true")
print "script returns SUCCESS"
except:
save()
cancelEdit(defaultAnswer="y")
print "Error while trying to connect to server !!!"
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()Also I made the alinement's properly and the script is running properly with out any error.
print "Starting the script ..."
connect('weblogic','weblogic','t3://localhost:7001')
edit()
startEdit()
servermb=getMBean("Servers/AdminServer")
if servermb is None:
print 'Value is Null'
else:
# Creating the JMS Server
jmsserver1mb = create('WLSTJMSServer','JMSServer')
jmsserver1mb.addTarget(servermb)
# Creating the JMS Module
jmsMySystemResource = create("WLSTJmsSystemResource","JMSSystemResource")
jmsMySystemResource.addTarget(servermb)
subDep1mb = jmsMySystemResource .createSubDeployment('WLSTJMSSubDeployment')
subDep1mb.addTarget(jmsserver1mb)
theJMSResource = jmsMySystemResource.getJMSResource()
connfact1 = theJMSResource.createConnectionFactory('WLSTConnFact1')
connfact1.setJNDIName('jms.WLSTConnFact1')
connfact1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue1..."
jmsqueue1 = theJMSResource.createQueue('WLSTJMSQueue1')
jmsqueue1.setJNDIName('jms.WLSTJMSQueue1')
jmsqueue1.setSubDeploymentName('WLSTJMSSubDeployment')
print "Creating WLSTQueue2..."
jmsqueue2 = theJMSResource.createQueue('WLSTJMSQueue2')
jmsqueue2.setJNDIName('jms.WLSTJMSQueue2')
jmsqueue2.setSubDeploymentName('WLSTJMSSubDeployment')
# try statement is working at only this point of the program
try:
save()
activate(block="true")
print "script returns SUCCESS"
except:
save()
cancelEdit(defaultAnswer="y")
print "Error while trying to connect to server !!!"
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()Below is the output
java weblogic.WLST test.py
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Starting the script ...
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'Domain_7001'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit().
For more help, use help(edit)
You already have an edit session in progress and hence WLST will
continue with your edit session.
Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
MBean type JMSServer with name WLSTJMSServer has been created successfully.
MBean type JMSSystemResource with name WLSTJmsSystemResource has been created successfully.
Creating WLSTQueue1...
Creating WLSTQueue2...
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed
script returns SUCCESSRegards,
Ravish Mody
http://middlewaremagic.com/weblogic
Come, Join Us and Experience The Magic…
Edited by: Ravish Mody-MiddewareMagic on Mar 16, 2011 8:33 PM -
Partner Application written in other language than PL/SQL and Java
I have an application written in another language than PL/SQL or Java. I want to integrate this application as an Partner apps where I use the same user repository as Portal.
Can I integrate the application by calling a stored PL/SQL-procedure based on the PLSQL SSO APIs examples that authenticates the user based on the username/password in portal and redirects the user to the application ?
Are there any examples / references where this has been done ?
JensCheck out the PDK referance for URL-Services, which allow you to integrate with any web based service/content.
http://portalstudio.oracle.com/servlet/page?_pageid=350&_dad=ops&_schema=OPSTUDIO
Maybe you are looking for
-
Unable to edit some functions in APEX Sql Workshop
Hi Users are able to edit some procedures/functions in APEX SQL Work shop. ( Object Browser - functions - EDIT) When we press edit we get cursor in the code area and can edit some procedures, But for some procedures when we click edit we don't get cu
-
The PDF Maker tab missing from all MS office 365 programs. How do I get it back?
I have the 30 day trial version of MS office 365 and I upgraded my Adobe Actobat to a new Acrobat Std subscription. Why do I not have the PDF tab in the office applications? How do I get it?
-
Exploring xApps partnering opportunities.
Hi, I am exploring SAP partner program for developing PCAs on behalf of my organization. I did some reading but couldn't find answer to some basic questions. I will appreciate if someone can answer them on this forum. 1. We have developed certain BI
-
Getting application path when launching a Jar
Hi, very simple how do you get the application path when launching a jar file? NNiol
-
How to see emails in the folders in email
When I go into the emails and into my folders I can't open the folders and see the emails in the