DatabaseMetadata.getProcedure - MS SQL REMARK location?
Hey all,
Using the DatabaseMetaData.getProcedures() method to retrieve sprocs. I would like very much to use the procedure REMARK column, but I do not understand where to place this information in MS SQL 2005 for each sproc. Does anyone know please?
I saw some documentation in DB2 for a comment field, which I assume would return in the procedure REMARK field. If someone could verify DB2 location, as well as any other databases (Oracle, MySQL, Postgres, etc). MS SQL 2005 is my primary focus however.
edit: prefer to use JTDS (1.2.2 or higher), but if can also/only be accomplished with SQLJDBC.jar, please identify.
Edited by: binarymonk_01 on Jul 9, 2008 6:16 AM
Also If I change to NAT from the public IP to the NLB IP to use either one of the phsyical IPs of the NLB cluster (192.168.0.50 or 51) it works fine when using the public IP. So it's definatly an issue when NATing the VIP of NLB cluster.
Chris
Similar Messages
-
In which jar com.evermind.sql.DriverManagerDataSource located??
in data-sources.xml when i changed the class from com.evermind.sql.DriverManagerDataSource to oracle.jdbc.pool.OracleDataSource i didnt get any exception in std_err log and also it didnt create any spy.log;
when i put class="com.evermind.sql.DriverManagerDataSource " in datasources.xml i am getting this exception
05/04/25 10:50:54 Error initializing data-source 'oraclePool': DriverManagerDataSource driver 'com.p6.engine.spy.P6SpyDriver' not found
in which jar com.evermind.sql.DriverManagerDataSource located??
<data-source
class="oracle.jdbc.pool.OracleDataSource"
name="oraclePool"
location="oraclePool"
xa-location="oraclePool"
ejb-location="oraclePool"
connection-driver="com.p6.engine.spy.P6SpyDriver"
username="egl1005"
password="egl"
url="jdbc:oracle:thin:@192.168.68.44:1521:egl"
inactivity-timeout="30"
/>
this batch file is okay??in home/lib/p6spy.jar is there ;and in node1\lib spy.properties is located.
set path=c:\j2sdk1.4.2_06\bin;
set classpath=C:\OC4J_EXTENDED\j2ee\home\lib;C:\OC4J_EXTENDED\j2ee\home\node1\lib;%classpath%;
java -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000 -Xdebug -Xnoagent -Djava.compiler=NONE -Xmx512m -Dhttp.session.debug=true -Djdbc.connection.debug=true -Dp6.home=C:\OC4J_EXTENDED\j2ee\home\lib -Dp6trace=true -jar oc4j.jar -config node1\config\server.xml -userThreads -verbosity 10 -out node1\log\std_out.log -err node1\log\std_err.logHere is the instructions how to use P6SPY with OC4J 9.0.4/10.1.2
http://radio.weblogs.com/0135826/2004/03/30.html
-Debu -
My SQL is installed on the c: drive of my SAP server which is fine. However I want my database and log files to be saved to my D: drive. Currently when I look at the properties of my SAP demo database itsfile path is set to the c: drive. How do I update this location to the D: drive?
I even went to my server properties/database settings and changed the data and log file location to my D: drive. I then created a new company in SAP, but it's db properties still show the pathing going to the c: drive.Hi Robert ,
I am not sure whether this works for you or not . I think if you want to move database location , you need to use detach and attach function
Please take a look at this articles :
http://support.microsoft.com/kb/224071
Hope this helps
Bishal -
Where are the createDB2.sql and createDB3.sql files located?
I have looked in both the client and server installation software but cannot locate the files. Please advise or provide if possible.
Thanks!Hi,
I don't use RoboSource Control, but perhaps the following articles will help:
http://www.adobe.com/devnet-archive/robohelp/articles/robosource.html
http://kb2.adobe.com/cps/403/kb403869.html
http://help.adobe.com/en_US/RoboSourceControl/8.0/RoboSource_Control_Help/whatis.htm
Perhaps another forum member knows more about installing RoboSource Control.
Greet,
Willam -
DPM 2012 R2 CU4 protecting SQL 2014 AlwaysOn AG with Failover Cluster vs. DR location
Hello!
We have a problem protecting any Database of SQL 2014 AlwaysOn Availability Group with SQL Failover Cluster Instance when moved to DR location. Everything is protected using DPM 2012 R2 CU4 from Primary location.
FACTS
- all servers are Windows Server 2012 R2
- all servers are Virtual (except Hyper-V hosts obviously:)
- that means virtualization is based on Windows Server 2012 R2 Hyper-V
- all clusters (SQL, Exchange,...) are Guest Clusters on Hyper-V
- SQL 2014
- DPM 2012 R2 CU4
- Primary and DR location
SETUP
SQL
- Primary location: SQL 2014 Guest Cluster with SQL Failover Cluster Instance using Shared VHDX disks
- DR location: SQL 2014 Standalone using VHDX disks
- AlwaysOn Availability Group expands between the primary and DR location.
DPM
- Primary location: DPM 2012 R2 CU4
- DPM 2012 R2 CU4 Agents installed on every possible SQL 2014 Server.
SCENARIO
- DPM is backing up all the SQL Databases normally as long as they exist on any SQL Cluster Node on Primary location.
- As soon as any Database is moved to DR location, that Database is not backed up anymore with the following error.
DPM ERROR
Starting synchronization on SqlServerName\DatabaseName failed:
Error 104: An unexpected error occurred while the job was running.
Error details: The system cannot find the path specified (0x80070003)
Recommended action: Retry the operation.
TROUBLESHOOTING
- Tried to modify SQL Protection Group in DPM Server while Database was active on DR location
> error enumerating volumes or drives D:\, E:\, F:\ (I don't have exact error atm)
> this looks like DPM is not aware that DPM is active on DR location to me
- Checked Technet, blogs and forums; no useful information
QUESTION
Is this expected or by-design behavior? Is this a bug? I am aware there were quite some issues backing up AG's from DPM 2012 SP1 ans SQL 2012 on.
Does anybody have a lab of that kind to try it out?
Thank you!
Best Regards,
Damjan Grimšič
LpdOK. The issue has been resolved. Issue was related to possible Disks Owners in Failover Cluster Manager Console for SQL Cluster.
In Primary's site SQL Cluster Failover Manager Console / Storage / Disks.
SQL Server(s) from Secondary location need(s) to be unchecked as Possible owner(s) in Advanced Policies for all relevant Volumes.
Lpd -
Sql server to Oracle migration using java
I am doing a project in which i need to create a java application which migrates sql server(2000) db to oracle..kindly help me out
Thanks for your help..i do not want any third party
components..i am almost done with the tables
migration and am trying to figure out about
procedures..here is a code which does migrate
tables...hope it helps you too!
* Copyright Isocra Ltd 2004
* You can use, modify and freely distribute this file
as long as you credit Isocra Ltd.
* There is no explicit or implied guarantee of
functionality associated with this file, use it at
your own risk.
package com.isocra.util;
import java.sql.DatabaseMetaData;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.ResultSetMetaData;
import java.util.Properties;
import java.io.FileInputStream;
import java.io.IOException;
* This class connects to a database and dumps all
the tables and contents out to stdout in the form
of
* a set of SQL executable statements
ublic class db2sql {
/** Dump the whole database to an SQL string */
public static String dumpDB(Properties props) {
String driverClassName =
props.getProperty("driver.class");
String driverURL =
props.getProperty("driver.url");
// Default to not having a quote character
String columnNameQuote =
props.getProperty("columnName.quoteChar", "");
DatabaseMetaData dbMetaData = null;
Connection dbConn = null;
try {
Class.forName(driverClassName);
dbConn =
DriverManager.getConnection(driverURL, props);
dbMetaData = dbConn.getMetaData();
catch( Exception e ) {
System.err.println("Unable to connect to
database: "+e);
return null;
try {
StringBuffer result = new StringBuffer();
String catalog =
props.getProperty("catalog");
String schema =
props.getProperty("schemaPattern");
String tables =
props.getProperty("tableName");
ResultSet rs =
dbMetaData.getTables(catalog, schema, tables,
null);
if (! rs.next()) {
System.err.println("Unable to find any tables
matching: catalog="+catalog+" schema="+schema+"
tables="+tables);
rs.close();
lse {
// Right, we have some tables, so we
can go to work.
// the details we have are
// TABLE_CAT String => table catalog (may be null)
// TABLE_SCHEM String => table schema
(may be null)
// TABLE_NAME String => table name
// TABLE_TYPE String => table type. Typical types
are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL
TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
// REMARKS String => explanatory
comment on the table
// TYPE_CAT String => the types
catalog (may be null)
// TYPE_SCHEM String => the types
schema (may be null)
// TYPE_NAME String => type name (may
be null)
// SELF_REFERENCING_COL_NAME String
=> name of the designated "identifier" column of a
typed table (may be null)
// REF_GENERATION String => specifies
how values in SELF_REFERENCING_COL_NAME are created.
Values are "SYSTEM", "USER", "DERIVED". (may be
null)
// We will ignore the schema and
stuff, because people might want to import it
somewhere else
// We will also ignore any tables
that aren't of type TABLE for now.
// We use a do-while because we've
already caled rs.next to see if there are any rows
do {
String tableName = rs.getString("TABLE_NAME");
String tableType =
rs.getString("TABLE_TYPE");
if
("TABLE".equalsIgnoreCase(tableType)) {
result.append("\n\n--
"+tableName);
result.append("\nCREATE TABLE
"+tableName+" (\n");
ResultSet tableMetaData =
dbMetaData.getColumns(null, null, tableName, "%");
boolean firstLine = true;
while (tableMetaData.next()) {
if (firstLine) {
firstLine = false;
} else {
// If we're not the first line, then finish
the previous line with a comma
result.append(",\n");
String columnName =
tableMetaData.getString("COLUMN_NAME");
String columnType =
tableMetaData.getString("TYPE_NAME");
// WARNING: this may give
daft answers for some types on some databases (eg
JDBC-ODBC link)
int columnSize =
tableMetaData.getInt("COLUMN_SIZE");
String nullable =
tableMetaData.getString("IS_NULLABLE");
String nullString =
"NULL";
if
("NO".equalsIgnoreCase(nullable)) {
nullString = "NOT
NULL";
result.append("
"+columnNameQuote+columnName+columnNameQuote+"
"+columnType+" ("+columnSize+")"+" "+nullString);
tableMetaData.close();
// Now we need to put the
primary key constraint
try {
ResultSet primaryKeys =
dbMetaData.getPrimaryKeys(catalog, schema,
tableName);
// What we might get:
// TABLE_CAT String => table catalog (may be null)
// TABLE_SCHEM String =>
table schema (may be null)
// TABLE_NAME String =>
table name
// COLUMN_NAME String =>
column name
// KEY_SEQ short =>
sequence number within primary key
// PK_NAME String =>
primary key name (may be null)
String primaryKeyName =
null;
StringBuffer
primaryKeyColumns = new StringBuffer();
while
(primaryKeys.next()) {
String thisKeyName =
primaryKeys.getString("PK_NAME");
if ((thisKeyName !=
null && primaryKeyName == null)
||
(thisKeyName == null && primaryKeyName != null)
||
(thisKeyName != null && !
thisKeyName.equals(primaryKeyName))
||
(primaryKeyName != null && !
primaryKeyName.equals(thisKeyName))) {
// the keynames
aren't the same, so output all that we have so far
(if anything)
// and start a
new primary key entry
if
(primaryKeyColumns.length() > 0) {
// There's
something to output
esult.append(",\n PRIMARY KEY ");
if
(primaryKeyName != null) {
result.append(primaryKeyName); }
esult.append("("+primaryKeyColumns.toString()+")");
// Start again with the new name
primaryKeyColumns
= new StringBuffer();
primaryKeyName =
thisKeyName;
// Now append the column
if
(primaryKeyColumns.length() > 0) {
rimaryKeyColumns.append(", ");
primaryKeyColumns.append(primaryKeys.getString("COLUMN
_NAME"));
if (primaryKeyColumns.length() > 0) {
// There's something
to output
result.append(",\n
PRIMARY KEY ");
if (primaryKeyName !=
null) { result.append(primaryKeyName); }
result.append("
("+primaryKeyColumns.toString()+")");
tch (SQLException e) {
// NB you will get this
exception with the JDBC-ODBC link because it says
// [Microsoft][ODBC
Driver Manager] Driver does not support this
function
ystem.err.println("Unable to get primary keys for
table "+tableName+" because "+e);
result.append("\n);\n");
// Right, we have a table, so
we can go and dump it
dumpTable(dbConn, result,
tableName);
hile (rs.next());
rs.close();
dbConn.close();
return result.toString();
} catch (SQLException e) {
e.printStackTrace(); //To change body of catch
statement use Options | File Templates.
return null;
/** dump this particular table to the string
buffer */
private static void dumpTable(Connection dbConn,
StringBuffer result, String tableName) {
try {
// First we output the create table stuff
PreparedStatement stmt =
dbConn.prepareStatement("SELECT * FROM "+tableName);
ResultSet rs = stmt.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int columnCount =
metaData.getColumnCount();
// Now we can output the actual data
result.append("\n\n-- Data for "+tableName+"\n");
while (rs.next()) {
result.append("INSERT INTO "+tableName+" VALUES
for (int i=0; i<columnCount; i++) {
if (i > 0) {
result.append(", ");
Object value = rs.getObject(i+1);
if (value == null) {
result.append("NULL");
lse {
String outputValue =
value.toString();
outputValue =
outputValue.replaceAll("'","\\'");
esult.append("'"+outputValue+"'");
result.append(");\n");
rs.close();
stmt.close();
} catch (SQLException e) {
System.err.println("Unable to dump table
"+tableName+" because: "+e);
/** Main method takes arguments for connection to
JDBC etc. */
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("usage: db2sql <property
file>");
// Right so there's one argument, we assume it's a
property file
// so lets open it
Properties props = new Properties();
try {
props.load(new FileInputStream(args[0]));
System.out.println(dumpDB(props));
} catch (IOException e) {
System.err.println("Unable to open
property file: "+args[0]+" exception: "+e);
}hi,
Thanks i used your coding and it works well...
i also used other thing i inserting the queries and values in another schema with primary and foreign keys.. it works well..
but problem is i cannot retrieve the unique constraint and other check constraint..
i cannot insert it..
and also i cannot create table in order i create the original..
because the retrieve query s values display based on ascending order i want display query in creation time...
because when i foreign keys .. the references in available before i create the table..that means a(table name) followed b(table name) .. a(table name) has contain foreign key of b(table name) .. but b (table name) not yet to create .. is possible.. to retrieve based creation time... -
Get result from PL/SQL function through XDBUri (10g)
Hi!
I have to call a PL/SQL function that takes two parameters and return one parameter. (I will do this from Oracle Service Bus).
It is possible to get relational data as xml through an XDBUri type over http by using the XML DB functionality. But is it possible to get the result of a PL/SQL function as XML as well?
I have tried to wrap the PL/SQL procedure inside a view, but cant get the variable to be bound into the sql.
I have tried with stuff like this:
create or replace view test (a, b)
as
select function(a, b) from dual
But since I dont have a table returning the values i cant get it work.
If I can make this view, I can call it through the XDMUri type.
Sombody that can help me to manage this?
/Helge
Edited by: user3169245 on 03.apr.2009 12:06Here's a code snippet that may help
package com.oracle.st.xmldb.pm.xfiles;
import com.oracle.st.xmldb.pm.multipart.InputStreamProcessor;
import com.oracle.st.xmldb.pm.multipart.MultipartInputStream;
import java.io.IOException;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.OracleDriver;
import oracle.jdbc.OracleCallableStatement;
import com.oracle.st.xmldb.pm.multipart.MultipartProcessor;
import com.oracle.st.xmldb.pm.multipart.MultipartProcessorImpl;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Enumeration;
import oracle.jdbc.OraclePreparedStatement;
import oracle.jdbc.OracleResultSet;
import oracle.jdbc.OracleTypes;
import oracle.sql.BLOB;
import oracle.sql.CLOB;
import oracle.xdb.XMLType;
import oracle.xml.parser.v2.XMLDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
public class XFilesServlet extends HttpServlet implements InputStreamProcessor {
public static String TARGET_PATH = "target";
public static String STYLESHEET_PATH = "stylesheet";
private static String CREATE_RESOURCE_SQL =
"begin " +
" XFILES_SOAP_SERVICES.UPLOADRESOURCE" +
" ( " +
" P_RESOURCE_PATH => :1, " +
" P_CONTENT => :2, " +
" P_CONTENT_TYPE => :3," +
" P_DESCRIPTION => :4," +
" P_LANGUAGE => :5," +
" P_CHARACTER_SET => :6," +
" P_DUPLICATE_POLICY => :7" +
" );" +
"end;";
private static String GET_FOLDER_HTML_PAGE_SQL =
"select xdburitype('/XFILES/lite/Folder.html').getClob() from dual";
private static String WRITE_LOG_RECORD_SQL =
"begin xfiles_logging.enqueue_log_record(:1); end;";
private OracleConnection dbConnection;
private OracleCallableStatement createResource;
private OracleCallableStatement writeLogRecord;
private DatabaseMetaData dbMetadata;
private static final int FILE_UPLOAD = 1;
private static final int PUBLISH_RSS = 2;
private static final int DB_REST_SERVICE = 3;
private static final int FORCE_AUTHENTICATION = 4;
private static final int SET_PASSWORD = 5;
private static final int DISPLAY_XML = 6;
private static final int ENABLE_RSS = 7;
public static final int XDB_ACCESS_DENIED = 31050;
private static String SERVLET_ROOT = "/sys/servlets/XFILES";
private static final String FILE_UPLOAD_PATH = "fileUpload";
private static final String PUBLISH_RSS_PATH = "publishRSS";
private static final String SET_PASSWORD_PATH = "setPassword";
private static final String DB_REST_SERVICE_PATH = "dbRestService";
private static final String FORCE_AUTHENTICATION_PATH = "doAuthentication";
private static final String DISPLAY_XML_PATH = "displayXML";
private static final String ENABLE_RSS_PATH = "enableRSS";
public static String POST_UPLOAD_URL = "postUploadRedirect";
public static String DULPLICATE_POLICY = "duplicatePolicy";
public static String SOURCE_FILE_PATH = "sourceFilePath";
public static String RESOURCE_FILENAME = "targetFileName";
public static String RESOURCE_DESCRIPTION = "description";
public static String UPLOAD_LANGUAGE = "UploadLanguage";
public static String UPLOAD_CHARACTERSET = "UploadCharset";
public static String PASSWORD = "password";
public static String XML_DOCUMENT = "content";
public static String XML_CHUNK = "chunk";
public static String RESOURCE_ID = "resid";
public static String DATABASE_SCHEMA = "DatabaseSchema";
public static String PACKAGE = "Package";
public static String METHOD = "Method";
public static String SQL_CALL = "SqlOperation";
protected XMLDocument logRecord;
protected Element parameterList;
protected Element timings;
protected int currentOperation;
public String xmlContent;
public static String XML_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS000";
public static String LOG_TIMESTAMP_FORMAT = "HH:mm:ss.SSS000";
protected SimpleDateFormat xmlDateFormatter = new SimpleDateFormat(XML_TIMESTAMP_FORMAT);
private String postUploadURL;
private String targetFolder;
private String onDuplicateAction;
private String sourceFile;
private BLOB resourceContent;
private String contentType;
private String resourceName;
private String resourceComment;
private String uploadLanguage;
private String uploadCharacterSet;
public XFilesServlet() {
private void logParameter(Document doc)
this.parameterList.appendChild(logRecord.importNode(doc.getDocumentElement().cloneNode(true),true));
private void logParameter(String parameterName, String[] values)
Element e = this.logRecord.createElement(parameterName);
this.parameterList.appendChild(e);
if (values != null)
Attr a = this.logRecord.createAttribute("Length");
e.setAttributeNode(a);
a.setValue(Integer.toString(values.length));
for (int i = 0; i < values.length; i++)
Element v = this.logRecord.createElement("parameterValue");
e.appendChild(v);
Text t = this.logRecord.createTextNode(values);
v.appendChild(t);
a = this.logRecord.createAttribute("Index");
v.setAttributeNode(a);
a.setValue(Integer.toString(i));
public void logParameter(String parameterName,String value)
Element e = this.logRecord.createElement(parameterName);
this.parameterList.appendChild(e);
if (value != null)
Text t = this.logRecord.createTextNode(value);
e.appendChild(t);
private void logParameterCDATA(String parameterName,String value)
Element e = this.logRecord.createElement(parameterName);
this.parameterList.appendChild(e);
if (value != null)
CDATASection c = this.logRecord.createCDATASection(value);
e.appendChild(c);
private void logException(Exception e) {
Element stackTrace = this.logRecord.createElement("StackTrace");
this.logRecord.getDocumentElement().appendChild(stackTrace);
this.appendException(stackTrace,e);
private void appendException(Element stackTrace, Throwable error)
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
error.printStackTrace(pw);
pw.flush();
pw.close();
Text t = this.logRecord.createCDATASection(sw.toString());
stackTrace.appendChild(t);
if (error.getCause() != null)
Element causedBy = this.logRecord.createElement("CausedBy");
stackTrace.appendChild(causedBy);
appendException(causedBy,error.getCause());
else {
if (error instanceof ServletException) {
ServletException se = (ServletException) error;
if (se.getRootCause() != null) {
Element causedBy = this.logRecord.createElement("CausedBy");
stackTrace.appendChild(causedBy);
appendException(causedBy,se.getRootCause());
private void logTimestamp(String eventName)
Timestamp ts = new Timestamp(System.currentTimeMillis());
Element element = logRecord.createElement(eventName);
this.timings.appendChild(element);
Text text = logRecord.createTextNode(this.xmlDateFormatter.format(ts));
element.appendChild(text);
protected void initiateLogging(HttpServletRequest request)
throws IOException
this.logRecord = new XMLDocument();
Element root = this.logRecord.createElement("XFilesLogRecord");
this.logRecord.appendChild(root);
Element e = this.logRecord.createElement("HttpRequest");
root.appendChild(e);
Element e1 = this.logRecord.createElement("ServletName");
Text t = this.logRecord.createTextNode(this.getClass().getName());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("HttpMethod");
t = this.logRecord.createTextNode(request.getMethod());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RequestURI");
t = this.logRecord.createTextNode(request.getRequestURI());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("PathTranslated");
t = this.logRecord.createTextNode(request.getPathTranslated());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RequestURL");
t = this.logRecord.createTextNode(new String(request.getRequestURL()));
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("Protocol");
t = this.logRecord.createTextNode(request.getProtocol());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("ServerName");
t = this.logRecord.createTextNode(request.getServerName());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("ContentType");
t = this.logRecord.createTextNode(request.getContentType());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("LocalAddr");
t = this.logRecord.createTextNode(request.getLocalAddr());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("LocalName");
t = this.logRecord.createTextNode(request.getLocalName());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("LocalPort");
t = this.logRecord.createTextNode(Integer.toString(request.getLocalPort()));
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("Port");
t = this.logRecord.createTextNode(Integer.toString(request.getServerPort()));
e1.appendChild(t);
e.appendChild(e1);
this.timings = this.logRecord.createElement("Timestamps");
root.appendChild(this.timings);
logTimestamp("Init");
e = this.logRecord.createElement("Remote");
root.appendChild(e);
e1 = this.logRecord.createElement("RemoteHost");
t = this.logRecord.createTextNode(request.getRemoteHost());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RemoteAddress");
t = this.logRecord.createTextNode(request.getRemoteAddr());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RemotePort");
t = this.logRecord.createTextNode(Integer.toString(request.getRemotePort()));
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RemoteUser");
t = this.logRecord.createTextNode(request.getRemoteUser());
e1.appendChild(t);
e.appendChild(e1);
e = this.logRecord.createElement("RequestHeaders");
root.appendChild(e);
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements())
String headerName = (String) headerNames.nextElement();
e1 = this.logRecord.createElement(headerName);
t = this.logRecord.createTextNode(request.getHeader(headerName));
e1.appendChild(t);
e.appendChild(e1);
this.parameterList = this.logRecord.createElement("ServletParameters");
root.appendChild(parameterList);
public void writeLogRecord(XMLDocument logRecord) throws SQLException , IOException {
XMLType xml = new XMLType(this.dbConnection, logRecord);
this.writeLogRecord.setObject(1, xml);
this.writeLogRecord.execute();
this.dbConnection.commit();
protected String readParameter(HttpServletRequest request,String parameterName,String defaultValue)
String value = request.getParameter(parameterName);
if (value != null)
if (value.length() == 0) {
value = null;
if (value == null) {
value = defaultValue;
logParameter(parameterName,value);
return value;
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException
try {
try {
initiateLogging(request);
initializeDatabaseConnection();
String requestURI = request.getRequestURI();
this.currentOperation = getOperation(requestURI);
switch (this.currentOperation) {
case DB_REST_SERVICE:
restResponse(request,response);
break;
default:
response.sendError(HttpServletResponse.SC_NOT_FOUND);
logTimestamp("Complete");
writeLogRecord(this.logRecord);
this.dbConnection.commit();
catch (Exception e) {
try {
this.dbConnection.rollback();
logTimestamp("Exception");
logException(e);
writeLogRecord(this.logRecord);
catch (Exception wle) {
System.out.println("XFilesServlet : Fatal error while logging Error : ");
e.printStackTrace(System.out);
System.out.flush();
wle.printStackTrace(System.out);
System.out.flush();
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
finally {
try {
this.createResource.close();
this.writeLogRecord.close();
catch (SQLException e) {
System.out.println("XFilesServlet : Fatal error while closing statements : ");
e.printStackTrace(System.out);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (IOException ioe) {
System.out.println("XFilesServlet : Fatal error while Sending Error Status : ");
ioe.printStackTrace(System.out);
System.out.flush();
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
doGet(req, res);
private void initializeDatabaseConnection() throws SQLException {
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
OracleDriver ora = new OracleDriver();
this.dbConnection = (OracleConnection) ora.defaultConnection();
this.createResource = (OracleCallableStatement) this.dbConnection.prepareCall(this.CREATE_RESOURCE_SQL);
this.writeLogRecord = (OracleCallableStatement) this.dbConnection.prepareCall(this.WRITE_LOG_RECORD_SQL);
this.dbMetadata = this.dbConnection.getMetaData();
private int getOperation(String requestURI) {
String servletTarget = requestURI.substring(this.SERVLET_ROOT.length()+1);
if (servletTarget.indexOf('/') > -1) {
servletTarget = servletTarget.substring(0,servletTarget.indexOf("/"));
if (servletTarget.equals(this.FILE_UPLOAD_PATH)) return FILE_UPLOAD;
if (servletTarget.equals(this.FORCE_AUTHENTICATION_PATH)) return this.FORCE_AUTHENTICATION;
if (servletTarget.equals(this.PUBLISH_RSS_PATH)) return this.PUBLISH_RSS;
if (servletTarget.equals(this.DB_REST_SERVICE_PATH)) return this.DB_REST_SERVICE;
if (servletTarget.equals(this.SET_PASSWORD_PATH)) return this.SET_PASSWORD;
if (servletTarget.equals(this.DISPLAY_XML_PATH)) return this.DISPLAY_XML;
if (servletTarget.equals(this.ENABLE_RSS_PATH)) return this.ENABLE_RSS;
return 0;
public void processParameter(String name, String value)
throws SQLException {
logParameter(name,value);
if (name.equals(this.TARGET_PATH)) {
this.targetFolder = value;
if (name.equals(this.POST_UPLOAD_URL)) {
this.postUploadURL = value;
if (name.equals(this.UPLOAD_LANGUAGE)) {
this.uploadLanguage = value;
if (name.equals(this.UPLOAD_CHARACTERSET)) {
this.uploadCharacterSet = value;
if (name.equals(this.DULPLICATE_POLICY)) {
this.onDuplicateAction = value;
if (name.equals(this.SOURCE_FILE_PATH)) {
this.sourceFile = value;
if (name.equals(MultipartProcessor.MULTIPART_CONTENT_TYPE)) {
this.contentType = value;
if (name.equals(this.RESOURCE_FILENAME)) {
this.resourceName = value;
if (name.equals(this.RESOURCE_DESCRIPTION)) {
this.resourceComment = value;
createNewResource();
private void restResponse(HttpServletRequest request, HttpServletResponse response)
throws IOException, SQLException, ServletException {
String requestURI = request.getRequestURI();
String restTarget = requestURI.substring(this.SERVLET_ROOT.length() + this.DB_REST_SERVICE_PATH.length()+1);
if (restTarget.contains("//")) {
// Cannot have // in URL
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
if (restTarget.length() < 4) {
// URL is too short to be valid - Minumum is /A/B
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
if (!restTarget.startsWith("/")) {
// Invalid URL
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
if (!restTarget.substring(1).contains("/")) {
// URL must contain /Schema/Method, may Contain /Schema/Package/Method
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
String schemaName = restTarget.substring(1,restTarget.substring(1).indexOf("/")+1);
restTarget = restTarget.substring(schemaName.length()+1);
logParameter(this.DATABASE_SCHEMA,schemaName);
String packageName = null;
if (restTarget.substring(1).contains("/")) {
// URL contains /Schema/Package/Method
packageName = restTarget.substring(1,restTarget.substring(1).indexOf("/")+1);
restTarget = restTarget.substring(packageName.length()+1);
logParameter(this.PACKAGE,packageName);
if (restTarget.substring(1).contains("/")) {
// URL must be /Schema/Method or /Schema/Package/Method, anything else is junk
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
String methodName = restTarget.substring(1);
logParameter(this.METHOD,methodName);
int responseCode = verifyTarget(request,schemaName,packageName,methodName);
if (responseCode != HttpServletResponse.SC_OK) {
System.out.println("Status Code = " + responseCode);
response.sendError(responseCode);
return;
String target = "\"" + schemaName + "\".";
if (packageName != null) {
target = target + "\"" + packageName + "\".";
target = target + "\"" + methodName + "\"";
int index;
Enumeration parmNames;
String sqlStatementText =
"begin" + "\n" +
" :1 := " + target + "(" + "\n";
index = 1;
parmNames = request.getParameterNames();
while (parmNames.hasMoreElements()) {
index++;
sqlStatementText = sqlStatementText + "\"" + parmNames.nextElement() + "\" => :" + index + " ";
if (parmNames.hasMoreElements()) {
sqlStatementText = sqlStatementText + ",\n";
sqlStatementText = sqlStatementText + ");\nend;";
logParameterCDATA(this.SQL_CALL,sqlStatementText);
OracleCallableStatement statement = (OracleCallableStatement) this.dbConnection.prepareCall(sqlStatementText);
index = 1;
parmNames = request.getParameterNames();
while (parmNames.hasMoreElements()) {
index++;
String parameterName = (String) parmNames.nextElement();
String parameterValue = (String) request.getParameter(parameterName);
logParameter(parameterName,parameterValue);
statement.setString(index,parameterValue);
XMLType xml = null;
try {
statement.registerOutParameter(1,OracleTypes.OPAQUE,"SYS.XMLTYPE");
statement.execute();
xml = (XMLType) statement.getObject(1);
statement.close();
catch (SQLException sqle) {
statement.close();
if (xml != null) xml.close();
if (sqle.getErrorCode() == this.XDB_ACCESS_DENIED) {
logTimestamp("RequestAuthorization");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
ServletException se = new ServletException("Unexpected SQL Error",sqle);
throw se;
response.setContentLength(0);
response.setContentType("text/xml");
xml.writeToOutputStream(response.getOutputStream());
xml.close();
response.getOutputStream().flush();
response.getOutputStream().write( new byte[] {'\r','\n'} );
// response.getOutputStream().flush();
response.getOutputStream().close();
response.setStatus(HttpServletResponse.SC_OK);
private int verifyTarget(HttpServletRequest request, String schemaName, String packageName, String methodName)
throws SQLException {
int response = HttpServletResponse.SC_NOT_FOUND;
boolean parameterValid = false;
ResultSet procedure = null;
procedure = this.dbMetadata.getProcedures(packageName,schemaName,methodName);
while (procedure.next()) {
response = HttpServletResponse.SC_OK;
response = verifyMandatoryParameters(request,schemaName,packageName,methodName);
if (response == HttpServletResponse.SC_OK) {
response = verifyOptionalParameters(request,schemaName,packageName,methodName);
return response;
private int verifyMandatoryParameters(HttpServletRequest request, String schemaName, String packageName, String methodName) throws SQLException {
// Check Mandatory Parameters are present.
ResultSet columns = null;
columns = this.dbMetadata.getProcedureColumns(packageName,schemaName,methodName,"%");
while (columns.next()) {
short nullable = columns.getShort(12);
String columnName = columns.getString(4);
if (nullable == DatabaseMetaData.procedureNoNulls) {
if (request.getParameter(columnName) == null) {
columns.close();
return HttpServletResponse.SC_BAD_REQUEST;
return HttpServletResponse.SC_OK;
private int verifyOptionalParameters(HttpServletRequest request, String schemaName, String packageName, String methodName) throws SQLException {
// Check Optional Parameters are valid
Enumeration parms = request.getParameterNames();
ResultSet column = null;
while (parms.hasMoreElements()) {
String columnName = (String) parms.nextElement();
column = this.dbMetadata.getProcedureColumns(packageName,schemaName,methodName,columnName);
if (!column.next()) {
column.close();
return HttpServletResponse.SC_BAD_REQUEST;
column.close();
return HttpServletResponse.SC_OK; -
Login failed when i login to a SQL server in a different domain
Hi Experts,
I have a this issue. When i try to connect to a SQL server located in another domain (Domain A) with a management studio of the same version in another domain (Domain B) It is not allowing me. I am getting the below error.
Error content details:
===================================
Cannot connect to Server_sql.E2K.AD.GE.COM.
===================================
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=53&LinkId=20476
Error Number: 53
Severity: 20
State: 0
Program Location:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.SqlStudio.Explorer.ObjectExplorerService.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
When i connect to the SQL server which is in Domain A using its IP (SQL Server in Domain A's IP) in the SQL management studio with my Domain B account as below then it is able to connect and showing the database and everything.
There is totally a 2 ways Forest trust between Domain A and Domain B.
Can any one help please.
Gautam.75801Hi
I think the Network Admin should create an account in Active Directory as well and then adding it to the host server... Otherwise , connect with SQL Authentication.
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Table does not exist (servlet accessing the postgres sql table)
Hello every body,
I am running servlet to access the postgres sql table. But there exist error.
ERROR: relation "employee" does not exist
I have checked the table name in database and table name into the servlet. Both are same. Please give me suggestion to solve this error.
Thankscan you connect to the database without the servlet?
put your stuff into this and try it. If it works, add something to check the table names. - %
package test;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
* Connect to a database using JDBC
public class ConnectionTest
private static final String DEFAULT_DRIVER = "your driver here";
private static final String DEFAULT_URL = "your url here";
private static final String DEFAULT_USERNAME = "your username here";
private static final String DEFAULT_PASSWORD = "your password here";
public static void main(String[] args)
Connection connection = null;
ResultSet rs = null;
try
String driver = ((args.length > 0) ? args[0] : DEFAULT_DRIVER);
Class.forName(driver);
String url = ((args.length > 1) ? args[1] : DEFAULT_URL);
String username = ((args.length > 2) ? args[2] : DEFAULT_USERNAME);
String password = ((args.length > 3) ? args[3] : DEFAULT_PASSWORD);
connection = DriverManager.getConnection(url, username, password);
DatabaseMetaData databaseMetaData = connection.getMetaData();
System.out.println("product: " + databaseMetaData.getDatabaseProductName());
System.out.println("major : " + databaseMetaData.getDatabaseMajorVersion());
System.out.println("minor : " + databaseMetaData.getDatabaseMinorVersion());
System.out.println("schemas");
rs = databaseMetaData.getSchemas();
while (rs.next())
System.out.println(rs.getString(1));
catch (Exception e)
e.printStackTrace();
finally
close(rs);
close(connection);
public static void close(ResultSet resultSet)
try
if (resultSet != null)
resultSet.close();
catch (Exception e)
e.printStackTrace();
public static void close(Statement statement)
try
if (statement != null)
statement.close();
catch (Exception e)
e.printStackTrace();
public static void close(Connection connection)
try
if (connection != null)
connection.close();
catch (Exception e)
e.printStackTrace();
} -
How can I debug a PL/SQL?
I want to debug a PL/SQL which located in a database in another computer. I use that computer's IP address, name and my local computer's IP address, SQL developers always has error:
Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '10.120.6.2', '2140' )
ORA-30683: failure establishing connection to debugger
ORA-12535: TNS:operation timed out
ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: at line 1
Process exited.
Does anyone have experience of debug a PL.SQL?
ThxI know the problem is, I use SQL Developer to debug remote database, so when it asks me "Debugger Host", I should fill in with my local machine's name or IP address. It can not recognize 127.0.0.1.
Any way, thx -
Hi,
I have been successfull in Publishing Web Service using SQL (DML) using :
1. Oracle Express Db 10.2
2. OC4J 10.1.3
Any Help Will be appreciated........ :)
NOTE: Oracle Documentation on Application Server SUCKS (Too Many Errors prints and Wrong Information in the Web Servises area including JAR file paths)
I can only use One parameter in the QUERY and a Second Parameter gives an Error.
java -jar ${ORACLE_HOME}/webservices/lib/wsa.jar -sqlAssemble -appName query -dataSource jdbc/OracleCoreDS -sqlstatement "updtProdTyp=update PRODUCT_TYPES SET NAME = :{newname VARCHAR} where NAME = :{oldname VARCHAR}" -dbConnection jdbc:oracle:thin:@localhost:1521:XE -dbUser store/store
INFO: [WSADBPlugin] endpoint setInterface: oracle.generated.SqlStmts, setImplementation: oracle.generated.SqlStmtsUser
INFO: java oracle.jpub.Doit -user=store/store -url=jdbc:oracle:thin:@localhost:1521:XE -dir=./src/server -codegen=jdbc -style=oracle/j2ee/ws/tools/wsa/db/webservices-common -style=oracle/j2ee/ws/tools/wsa/db/webservices10 -style=oracle/j2ee/ws/tools/wsa/db/webservices10literal -outarguments=return -datasource=jdbc/OracleCoreDS -sqlstatement.updtProdTyp=update PRODUCT_TYPES SET NAME = :{newname VARCHAR} where NAME = :{oldname VARCHAR} -sqlstatement.class=SqlStmts -package=oracle.generated -plsqlfile=SqlStmts_plsql_wrapper.sql,SqlStmts_plsql_dropper.sql -plsqlpackage=SqlStmts_plsql_wrapper -connscope=method -sqlj -d=./war/WEB-INF/classes -C-g
INFO: SqlStmtsBase
/usr/lib/oracle/xe/app/OC4J/D_My_Apps/src/server/oracle/generated/SqlStmtsUser.java:8: oracle.generated.SqlStmtsUser is not abstract and does not override abstract method updtProdTypiSS(java.lang.String[],java.lang.String[]) in oracle.generated.SqlStmts
public class SqlStmtsUser extends SqlStmtsBase implements SqlStmts, java.rmi.Remote
^
/usr/lib/oracle/xe/app/OC4J/D_My_Apps/src/server/oracle/generated/SqlStmtsUser.java:22: cannot find symbol
symbol : method _getProdTypBeans(java.lang.String,java.sql.Connection)
location: class oracle.generated.SqlStmtsBase
__jRt_0 = super._getProdTypBeans(__jRt_2, __onnScopeMethod);
/usr/lib/oracle/xe/app/OC4J/D_My_Apps/src/server/oracle/generated/SqlStmtsUser.java:85: cannot find symbol
symbol : method _getProdTyp(java.lang.String,java.sql.Connection)
location: class oracle.generated.SqlStmtsBase
__jRt_0 = super._getProdTyp(__jRt_8, __onnScopeMethod);
^
/usr/lib/oracle/xe/app/OC4J/D_My_Apps/src/server/oracle/generated/SqlStmtsUser.java:128: _updtProdTyp(java.lang.String,java.lang.String,java.sql.Connection) in oracle.generated.SqlStmtsBase cannot be applied to (java.lang.String,java.sql.Connection)
__jRt_0 = super._updtProdTyp(__jRt_10, __onnScopeMethod);
^
/usr/lib/oracle/xe/app/OC4J/D_My_Apps/src/server/oracle/generated/SqlStmtsUser.java:145: cannot find symbol
symbol : method _updtProdTypiS(java.lang.String[],java.sql.Connection)
location: class oracle.generated.SqlStmtsBase
__jRt_0 = super._updtProdTypiS(__jRt_12, __onnScopeMethod);
^
6 errors
INFO: NEW DBWS runtimeProperties set databaseJndiName: jdbc/OracleCoreDS
INFO: User classpath is :/usr/lib/oracle/xe/app/OC4J/D_My_Apps/./war/WEB-INF/classes
INFO: Checking for JSR-181 Annotations capabilities in current JVM...
INFO: Found JSR-181 Annotations capabilities. Checking for JSR-181 Annotations Processor...
INFO: Found JSR-181 Annotations processor. JSR-181 Annotations (if any) will be processed
INFO: No JSR-181 annotations found in specified class oracle.generated.SqlStmtsUser
FINE: ValueTypeModeler.log [creating model: query]
FINE: ValueTypeModeler.log [creating port: oracle.generated.SqlStmts]
FINE: MethodModeler.log [creating operation: updtProdTyp]
FINE: MethodModeler.log [creating operation: updtProdTypiSS]
WARNING: Problem validating implementation class. Access modifier problem detected for the implementation class oracle.generated.SqlStmtsUser: int updtProdTyp( java.lang.String, java.lang.String ) is defined with access modifiers that make it an unsuitable implementation of the interface method: The method cannot be 'abstract'.
Thu Mar 30 14:17:34
Thanks
====================================I don't have the problem with the second arugument, using essentially the same command as yours. Could you make sure you clean up the following subdirectories and retry:
ear query.ear src war
My guess is that the leftover subdirectories in your previous run are playing game with you. You can simplify leftover management by specifying -output setting. -
Use of Input Variables in SQL-Queries Sometimes Not Possible
Only in simple SELECT-statements the use of input variables ([%0], [%1], etc.) work without problems.
In more complex queries the use of these variables is not possible (e.g. SELECT-statements with sub-queries, sometimes when UNION is used - but I couldn't find any general rule when the problems will arise; sometimes two different queries with the same query-structure behave in different ways when these variables are used).
In these cases the query is not executed - not even the input-window to enter values into the input variables is displayed. The query stops with some strange error-messages in the status line. These error-messages doesn't have any relation to the actual query - sometimes it refers to field-names never used in the query or refers to syntax error which do not exist.
If the input variables are replaced by constant values there are no problems so there can't be any syntax errors - the only difference is the presence or absence of input variables.
Example:
provided that the queries have a certain complexity
SELECT ...
FROM ... OINV Tx ...
WHERE ... Tx.DocDate >= [%0] ...
does not work,
SELECT ...
FROM ... OINV Tx ...
WHERE ... Tx.DocDate >= '1.1.2007' ...
works!
Does anybody have run into the same problem and now if it is a bug of SAP-BO or an error on behalf of the user? Does anybody know a way to correct the problem?
Thanks in advance!
Frank
By the way: Are there any rules where exactly input variables can be used in a query?
Only in SELECT-statements? Where there exactly?
In statements outside of SELECT?Only SAP Partners Can access service.sap.com/notes, but I think it is possible to search in them from the customer portal as well.
Here are summary of the two notes mentioned before this:
730960:
<i>
The following query is an example for how to define variables in long
queries rather than using "Fixed Declares".
You need to use exactly the same template as follows, do not delete
"comments" from this query.
The only changes you need to do :
1. In the first and in the fifth rows you need to select the table to which you would like to relate the variable e.g. in this example, the variable is related to the table VPM1 - 'Payments to Vendors - Rows'.
2. In the fourth and in the eighth rows you need to select the field to which you would like to define the variables e.g. in this example, the variable is the field 'DueDate'.
/SELECT FROM [dbo].[VPM1] T0/
declare @fromdate as datetime
/* WHERE */
set @fromdate = /* T0.DueDate */ '[%0]'
/SELECT FROM [dbo].[VPM1] T1/
declare @tilldate as datetime
/* WHERE */
set @tilldate = /* T0.DueDate */ '[%1]'
select OVPM.docnum, VPM1.dueDate,VPM1.CheckNum, VPM1.Branch,
VPM1.BankCode, VPM1.CheckSum, OVPM.CardName,
case
when OPCH.docnum is null then VPM2.docEntry
else OPCH.docnum
end as 'docnum'
from OVPM INNER join VPM1 on OVPM.docnum = VPM1.docnum
left join VPM2 LEFT JOIN OPCH ON VPM2.DocEntry = OPCH.DocEntry
on OVPM.docnum = VPM2.docnum
where OVPM.Canceled = 'N' AND VPM1.DueDate >=@fromdate AND
VPM1.DueDate <=@tilldate
</i>
955295:
<i>
Using SAP Business One Survey Variables (parameters) in a 'Set' SQL Statement can give an error in the Query Generator.
For Example:
Declare @Num as numeric(2)
Set @Num = [%0]
Select T0.DocNum
From ORDR T0
Where DocNum = @Num
Other terms
query, SQL, parameter, survey, variable, query generator, set, declare, [%0], table, error, SAP Business One
Reason and Prerequisites
FAQ
Solution
In such cases you need to put in an SQL remark statement a reference field in the DB for the Survey Variable (any field).
For Example: (to make the above query work)
Declare @Num as numeric(2)
Set @Num = /* T0.DocNum */ [%0]
Select T0.DocNum
From ORDR T0
Where docnum = @Num
</i> -
Java Stored Procedures + oralce.xdb.XMLType + initxdbj.sql
In order to use XMLType object in java stored procedures, I need to import oralce.xdb.XMLType package. I got compiler error saying "Class oracle.xdb.XMLType not found" (See List1).
I check my installed package, sure enough these is no "oracle/xdb/XMLType" or any xdb related one. (See list2) This surprises me since my 9i/Solaris installation was successful and spotless one.
The 9i App Dev - XML doc states that script $ORACLE_HOME/rdbms/admin/initxdbj.sql could install that package. (See List3) The fact is no way this script could be found from Oracle901/Solaris8 or Oracle901/NT installations.
If java program moved to client and included xdb_g.jar in CLASSPATH, then it is fine as Doc declares. It just failed to compile in server as stored procedures.
Please help, Thanks.
Andy Ting DBA (301)240-2223, [email protected](now include Listings)
In order to use XMLType object in java stored procedures, I need to import oralce.xdb.XMLType package. I got compiler error saying "Class oracle.xdb.XMLType not found" (See List1).
I check my installed package, sure enough these is no "oracle/xdb/XMLType" or any xdb related one. (See list2) This surprises me since my 9i/Solaris installation was successful and spotless one.
The 9i App Dev - XML doc states that script $ORACLE_HOME/rdbms/admin/initxdbj.sql could install that package. (See List3) The fact is no way this script could be found from Oracle901/Solaris8 or Oracle901/NT installations.
If java program moved to client and included xdb_g.jar in CLASSPATH, then it is fine as Doc declares. It just failed to compile in server as stored procedures.
Please help, Thanks.
Andy Ting DBA (301)240-2223, [email protected]
====================================================================
List 1:
sql> select NAME,TYPE,SEQUENCE,LINE,substr(text,1,80) TEXT from user_errors order BY 1,2,3,4
NAME TYPE SEQUENCE LINE
TEXT
proto4a/database/XMLTypeTest JAVA CLASS 1 0
ORA-29535: source requires recompilation
proto4a/database/XMLTypeTest JAVA SOURCE 1 0
proto4a/database/XMLTypeTest:11: Class oracle.xdb.XMLType not found in import.
proto4a/database/XMLTypeTest JAVA SOURCE 2 0
proto4a/database/XMLTypeTest:12: Class XMLTYPE not found in import.
proto4a/database/XMLTypeTest JAVA SOURCE 3 0
Info: 2 errors
==============================================================
List 2:
sql> select OWNER,OBJECT_NAME,OBJECT_TYPE from all_objects
where upper(object_name) like '%XMLTYPE%';
OWNER OBJECT_NAME OBJECT_TYP
SYS /219cdace_AQxmlTypeInfoRespons JAVA CLASS
/a341e963_AQxmlTypeInfoRequest
XMLTYPE TYPE
XMLTYPE TYPE BODY
XMLTYPE_LIB LIBRARY
PUBLIC /219cdace_AQxmlTypeInfoRespons SYNONYM
/a341e963_AQxmlTypeInfoRequest
sql> select OWNER,OBJECT_NAME,OBJECT_TYPE from all_objects
where upper(object_name) like '%XDB%';
no rows selected
====================================================================
List 3:
Installing and using oracle.xdb.XMLType class
The oracle.xdb.XMLType is available in the xdb_g.jar file in the ORACLE_
HOME/rdbms/jlib where ORACLE_HOME refers to the Oracle home directory.
Using oracle.xdb.XMLType inside JServer:
This class is pre-loaded in to the JServer and is available in the SYS schema.
It is not loaded however, if you have upgraded your database from an earlier
version. If you need to upload the class into the JServer, you would need to run the
initxdbj.sql file located in the ORACLE_HOME/rdbms/admin directory, while
connected as SYS.
Using oracle.xdb.XMLType on the client:
If you need to use the oracle.xdb.XMLType class on the client side, then ensure that
the xdb_g.jar file is listed in your CLASSPATH environment variable.
===================================================================== -
Periodic Importing of data from SQL Server into Oracle Database
I would like to know how I can use the SQL Developer tool to import data from a SQL Server database across the internet into an Oracle Database on a periodic basis? I understand there is a Migration Workbench, but it seems to be only a one off activity.
What I would really like is to be able to import data for example, very 30 minutes from multiple tables/views in a SQL Server Database into an Oracle Database (overwriting or modifying existing same data) without the need for Heterogeneous Connectivity, as my Oracle Database is not my LAN.
Thank you for your kind ideas and suggestions.To be honest the best way to do it is DG4ODBC or DG4MSQL. All other solutions need manual interaction.
The gateways DG4ODBC and DG4MSQL are independant from the Oracle database and also from the SQL Server location. In a worst case scenario you have an Oracle database on machine A, the gateway on machine B and the SQL Server on machine C.
Gateways were built to exactly do what you want. As you have access to the Oracle database the only part you need to define within the Oracle database is a db link. If you specify the full tns connect identifier there is even no need to edit the tnsnames.ora file.
Even if you excluded the gateway in your last sentence the best solution would be the gateway.
Another option you can use is the SQL Server linked server mechanism. It allows you to link another server using OLEDB driver. In your case you can then link the Oracle db into your SQL Server and then insert/update/delete and select Oracle tables from the SQL Server. Using now a trigger will replicate the data immediately to the Oracle db. -
Can a PL/SQL code of timesten be called in oracle or vice versa
Hi
In IMDB cache setup with AWT cache group , the pl/sql code or procedure that is written in oracleDB can it be called in TimesTen and vice versa
example: In a stored procedure the DML's that are performed will be updating the cache tables and log table in oracleDB.
Will there be any performance impact.
Regards
Siva KumarA PL/SQL procedure can exist in Oracle DB, in TimesTen, or in both. You control that by where you create the procedure. Procedures that exist in Oracle can really only be called in Oracle and can only access data in Oracle. Procedures that exist in TimesTen can only be called in TimesTen and can only access data in TimesTen. There is a limited capability, using the TimesTen PassThrough capability to call PL/SQL procedures located in Oracle, from Timesten, and for Timesten PL/SQL procedures to access data in Oracle. Using PassThrough does have some overhead.
Chris
Maybe you are looking for
-
How do you create PDF of multiple layers in Illustrator CS3 so each layer is on separate page?
I am using CS3 and designing business cards. I have 10 names layed out as a separate layer in Illustrator. I am now trying to save the Illustrator file as a PDF so that each business card appears on 1 page in 1 PDF document. The PDF is saving as one
-
Firewire Port out to lunch! Formac Studio goes with it! Help!
There was a nasty thunderstorm last night in my area. My computer was off the entire time, but upon restarting hours later, I found both my firewire ports out. This morning, one of them came back to life- but when I plugged my Formac studio into it-
-
Hi, I am getting below error when I try to drag and drop the adf-task-flow in to my .jspx page. Here the taskflow contains single page fragment. please help. ERROR: oracle.bali.xml.model.XmlInvalidOnCommitException: SEVERE: Element taskFlow not expec
-
Trim optimization in paper mills.
Dear all, i'm trying to understand the trim optimized model in SNO , Can any one provide me with the used nodes and details of the model. regards. Ahmad
-
i am making shopping mall project . ist page conatins list of product avaiale 2nd page contains list of manufacturuer avaible problem:- i want to display on 3rd page the product seleted by user in 1st page i used session tracking concept.but problem