Managing escape characters in SQL and Java
Hello All,
How can I manage special characters(ESPECIALLY single quotes) in my select statements?? If I have to query the database for the rows with name O'brain for example, I am writing a query
String SQL = "SELECT Name FROM MyTable where Name like 'O/'brain%' {escape '/'}";
But this is not working for me. I am using Sybase database. Can anyone help me out with this ?? I don't want to use prepared statements.
Thanks & Regards,
Sarada.
This might sort you out:
http://jregex.sourceforge.net/gstarted.html#appendix-d
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/ -
PL/SQL and Java Swing interface
Everybody in this forum knows that Oracle is the best database around
with many functionalities, stability, performance, etc. We also know
that PL/SQL is a great language to manipulate information directly
in the database with many built in functions, OOP capability,
transaction control, among other features. Today an application that
manipulates information, which needs user interface, requires components
to be developed using different technologies and normally running in
different servers or machines. For example, the interface is done using
a dynamic HTML generator like JSP, PHP, PL/SQL Web Toolkit, etc.
This page is executed in an application server like Oracle iAS or
Tomcat, just to name two, which in turn access a database like Oracle to
build the HTML. Also rich clients like Java applets require an intermediate
server to access the database (through servlets for example) although
it is possible to access the database directly but with security issues.
Another problem with this is that complexity increases a lot, many
technologies, skills and places to maintain code which leads to a greater
failure probability. Also, an application is constantly evolving, new
calculations are added, new tables, changed columns. If you have an
application with product code for example and you need to increase its
size, you need to change it in the database, search for all occurrences
of it in the middle-tier code and perhaps adjust interfaces. Normally
there is no direct dependency among the tier components. On another
issue, many application interfaces today are based on HTML which doesn't
have interactive capabilities like rich-client interfaces. Although it
is possible to simulate many GUI widgets with JavaScript and DHTML, it is
far from the interactive level we can accomplish in rich clients like
Java Swing, Flash MX, Win32, etc. HTML is also a "tag-based" language
originally created to publish documents so even small pages require
many bytes to be transmitted, far beyond of what we see on the screen.
Even in fast networks you have a delay time to wait the page to be
loaded. Another issue, the database is in general the central location
for all kinds of data. Most applications relies on it for security,
transaction and availability. My proposal is to use Oracle as the
central location for interface, processing and data. With this approach
we can create not only the data manipulation procedures in the database,
but procedures that also control and manage user interfaces. Having
a Oracle database as the central location for all components has many
advantages:
- Unique point of maintenance, backup and restore
- Integrated database security
- One language for everything, PL/SQL or Java (even both if desired)
- Inherited database cache, transaction and processing optimizations
- Direct access to the database dictionary
- Application runs on Oracle which has support for many platforms.
- Transparent use of parallel processing, clusters and future
background technologies
Regarding the interface, I already created a Java applet renderer
which receives instructions from the database on how to create GUI
objects and how to respond to events. The applet is only 8kb and can
render any Swing or AWT object/event. The communication is done
through HTTP or HTTPS using Oracles's MOD_PLSQL included in the Apache
HTTP server which comes with the database or application server (iAS).
I am also creating a database framework and APIs in PL/SQL to
create and manipulate the client interface. The applet startup is
very fast because it is very small, you don't need to download large
classes with the client interface. Execution is done "on-demand"
according to instructions received from the database. The instructions
are very optimized in terms of network bandwidth and based on preliminary
tests it can be up to 1/10 of a similar HTML screen. Less network usage
means faster response and means that even low speed connections will
have a good performance (a future development can be to use this in
wireless devices like PDAs e even cell phones, just an idea for now).
The applet can also be executed standalone by using Java Web Start.
With this approach no business code, except the interface, is executed
on the client. This means that alterations in the application are
dynamically reflected in the client, no need to "re-download" the
application. Events are transmitted when required only so network
usage is minimized. It is also possible to establish triggering
events to further reduce network usage. Since the protocol used is
HTTP (which is stateless), the database framework I am creating will
be responsible to maintain the state of connections, variables, locks
and session information, so the developer don't need to worry about it.
The framework will have many layers, from communication up to
application so there will be pre-built functions to handle queries,
pagination, lock, mail, log, etc. The final objective is to have a
rich client application integrated into the database with minimum
programming and maintenance requirements, not forgetting customization
capabilities. Below is a very small example of what can de done. A
desktop with two windows, each window with two fields, a button with an
image to switch the values, and events to convert the typed text when
leaving the field or double-clicking it. The "leave" event also has an
optimization to only be triggered when the text changes. I am still
developing the framework and adjusting the renderer but I think that all
technical barriers were transposed by now. The framework is still in
the early stages, my guess is that only 5% is done so far. As a future
development even an IDE can be created so we have a graphical environment
do develop applications. I am willing to share this with the PL/SQL
community and listen to ideas and comments.
Example:
create or replace procedure demo1 (
jre_version in varchar2 := '1.4.2_01',
debug_info in varchar2 := 'false',
compress_buffer in varchar2 := 'false',
optimize_buffer in varchar2 := 'true'
) as
begin
interface.initialize('demo1_init','JGR Demo 1',jre_version,debug_info,compress_buffer,optimize_buffer);
end;
create or replace procedure demo1_init as
begin
toolkit.initialize;
toolkit.create_icon('icon',interface.global_root_url||'img/switch.gif');
toolkit.create_internal_frame('frame1','Frame 1',50,50,300,136);
toolkit.create_label('frame1label1','frame1',10,10,50,20,'Field 1');
toolkit.create_label('frame1label2','frame1',10,40,50,20,'Field 2');
toolkit.create_text_field('frame1field1','frame1',50,10,230,20,'Field 1','Field 1',focus_event=>true,mouse_event=>true);
toolkit.create_text_field('frame1field2','frame1',50,40,230,20,'Field 2','Field 2',focus_event=>true,mouse_event=>true);
toolkit.set_text_field_event('frame1field1',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 1','false');
toolkit.set_text_field_event('frame1field2',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 2','false');
toolkit.set_text_field_event('frame1field1',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 1','false');
toolkit.set_text_field_event('frame1field2',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 2','false');
toolkit.create_button('button1','frame1',10,70,100,25,'Switch','Switch the values of "Field 1" and "Field 2"','S','icon');
toolkit.set_button_event('button1',toolkit.action_performed_event,'demo1_switch_fields(''frame1field1'',''frame1field2'')','frame1field1:'||toolkit.get_text_method||',frame1field2:'||toolkit.get_text_method);
toolkit.create_internal_frame('frame2','Frame 2',100,100,300,136);
toolkit.create_label('frame2label1','frame2',10,10,50,20,'Field 1');
toolkit.create_label('frame2label2','frame2',10,40,50,20,'Field 2');
toolkit.create_text_field('frame2field1','frame2',50,10,230,20,'Field 1','Field 1',focus_event=>true,mouse_event=>true);
toolkit.create_text_field('frame2field2','frame2',50,40,230,20,'Field 2','Field 2',focus_event=>true,mouse_event=>true);
toolkit.set_text_field_event('frame2field1',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 1','false');
toolkit.set_text_field_event('frame2field2',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 2','false');
toolkit.set_text_field_event('frame2field1',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 1','false');
toolkit.set_text_field_event('frame2field2',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 2','false');
toolkit.create_button('button2','frame2',10,70,100,25,'Switch','Switch the values of "Field 1" and "Field 2"','S','icon');
toolkit.set_button_event('button2',toolkit.action_performed_event,'demo1_switch_fields(''frame2field1'',''frame2field2'')','frame2field1:'||toolkit.get_text_method||',frame2field2:'||toolkit.get_text_method);
end;
create or replace procedure demo1_set_upper as
begin
toolkit.set_string_method(interface.global_object_name,toolkit.set_text_method,upper(interface.array_event_value(1)));
toolkit.set_text_field_event(interface.global_object_name,toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,upper(interface.array_event_value(1)),'false');
end;
create or replace procedure demo1_set_lower as
begin
toolkit.set_string_method(interface.global_object_name,toolkit.set_text_method,lower(interface.array_event_value(1)));
toolkit.set_text_field_event(interface.global_object_name,toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,lower(interface.array_event_value(1)),'false');
end;
create or replace procedure demo1_switch_fields (
field1 in varchar2,
field2 in varchar2
) as
begin
toolkit.set_string_method(field1,toolkit.set_text_method,interface.array_event_value(2));
toolkit.set_string_method(field2,toolkit.set_text_method,interface.array_event_value(1));
toolkit.set_text_field_event(field1,toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,upper(interface.array_event_value(2)),'false');
toolkit.set_text_field_event(field2,toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,upper(interface.array_event_value(1)),'false');
toolkit.set_text_field_event(field1,toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,lower(interface.array_event_value(2)),'false');
toolkit.set_text_field_event(field2,toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,lower(interface.array_event_value(1)),'false');
end;Is it sound like Oracle Portal?
But you want to save a layer 9iAS.
Basically, that was the WebDB.(Oracle changed the name to Portal when version 3.0)
Over all, I agree with you.
>>Having a Oracle database as the central location for all components has many
>>advantages:
>>
>>- Unique point of maintenance, backup and restore
>>- Integrated database security
>>- One language for everything, PL/SQL or Java (even both if desired)
>>- Inherited database cache, transaction and processing optimizations
>>- Direct access to the database dictionary
>>- Application runs on Oracle which has support for many platforms.
>>- Transparent use of parallel processing, clusters and future
>>background technologies
I would like to build 'ZOPE' inside Oracle DB as a back-end
Using Flash MX as front-end.
Thomas Ku. -
Help me out here! i'm having a problem updating our database with this call:
update table
set name = 'dave's store'
where id = '2';
The problem of course is that single quote in the name. i've check many sites and have tired everything.
-i have tried to escape the quote with a back (and forward!) slash, and nothing.
-i have padded the quote with another single quite (ie ''), but that doesn't work.
-i have have nearly all combinations of single and double quotes, with and without escape characters!
according to the documention, just the blackslash so be fine! any one have this problem as well?
any help would be greatly appreciated! thanks.Very related question.
Is there a way to make sure that all 'weird' characters in an SQL statement are escaped properly before the statement is executed?
I'm hoping that there is a method like this:
Statement stmt = stmt.escapeAllBadChars();
Is there such a method anywhere?
I can't find it anywhere :(
If not, is there a list of all 'bad characters' anywhere?
Thanks,
Otis
null -
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 -
PL/SQL and Java implementation
Hi all,
We need to implement a fast solution for reporting to our existing web application. Application is totally based on stored procedures written in PL/SQL.
We have already java classes for drawing different types of charts
named Chartdirector (http://www.advsofteng.com/)
This library can create chart images in memory.
I have already read about calling java classes from PL/SQL and SQLJ too.
My questions are;
1. Is this safe to include classes to database and create
reports by using loadjava in real life. I mean not in theory, in real life?
2. Is there any experiments of the audience about this method?
3. Would it be any performance problems about this?
4. Should i prefer to use any Java container and jsps instead of this method?
I will continue to research for necessary steps after i could see the light :)
Thank you to all,
Regards,
Gokhan> 1. Is this safe to include classes to database and create
reports by using loadjava in real life. I mean not in theory, in real life?
Yes.
> 2. Is there any experiments of the audience about this method?
Experiments and actual implementation - yes. It works. Granted, it does not always work as easy as running the Java code from the command line. But it does work.
> 3. Would it be any performance problems about this?
This is a potential problem with any software code.
4. Should i prefer to use any Java container and jsps instead of this method?
To be honest, I prefer not using Java for web graphics as I'm not impressed with the quality and flexibility of the graphs generated. I prefer using (and paying for commercial use) for the JPGraph classes for PHP - and using that from PL/SQL (via Zend Core for Oracle).
Another option is to use SVG and generated SVG directly from PL/SQL. But this requires a browser plugin and SVG also does not look that great. (this is btw what Oracle's HTMLDB does and uses) -
Official documents on escaping characters in SQL Server query statements
Hi,
Are there any official documents on how to escaping special characters in SQL Server query statements? I find a lot of online resources discussing about this, but there are no definitive conclusions on:
Which characters should be escaped? (Some only said single-quote needs to be escaped, double-quote does not need. While others said both need to be escaped)
How to escape characters? (Some said using two single-quote to escape a single-quote. Others said using a backslash, etc.)
So I just wonder if there is an official document from Microsoft regarding this?
Thanks
AlanDepends on where you're using them
If its string values then single quotes(') should be escaped by putting one more single quote before it.
If its LIKE operator you can use ESCAPE keyword or use [] to escapre special characters
see
http://visakhm.blogspot.in/2013/01/wildcard-character-based-pattern-search.html
If inside SSIS expression you can escape characters like \ " etc by adding an extra \ before the characters
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
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(); -
Escaping characters ( ) [ ] in sql contains
Please, help!
select * from mytable where (contains(BINARY_DATA, '<query-string>' ) > 0)where binary_data is BLOB field (indexed)
And i need to put, such strings for the query to work well : ( ) [ ]
% and _ were succesfully escaped, but i didnt find information on how the parentheses are escaped. Could you please help?
Thanks in advance.Also, ()[] are not indexed by basic lexer, therefore
where contains(text,'Hello\(World') > 0will match 'Hello ) World', 'Hello[World', etc:
[code]
SQL> drop table test_table
2 /
Table dropped.
SQL> create table test_table (id number,text blob)
2 /
Table created.
SQL> insert into test_table values (1,utl_raw.cast_to_raw ('Hello World'))
2 /
1 row created.
SQL> insert into test_table values (2,utl_raw.cast_to_raw ('Hello(World'))
2 /
1 row created.
SQL> insert into test_table values (3,utl_raw.cast_to_raw ('Hello)World'))
2 /
1 row created.
SQL> insert into test_table values (4,utl_raw.cast_to_raw ('Hello[World'))
2 /
1 row created.
SQL> insert into test_table values (5,utl_raw.cast_to_raw ('Hello]World'))
2 /
1 row created.
SQL> insert into test_table values (6,utl_raw.cast_to_raw ('Hello([World'))
2 /
1 row created.
SQL> insert into test_table values (7,utl_raw.cast_to_raw ('Hello(_World'))
2 /
1 row created.
SQL> create index test_table_idx on test_table (text) indextype is ctxsys.context
2 /
Index created.
SQL> select id from test_table where contains(text,'Hello World') > 0
2 /
ID
1
2
3
4
5
6
7
7 rows selected.
SQL> select id from test_table where contains(text,'Hello\(World') > 0
2 /
ID
1
2
3
4
5
6
7
7 rows selected.
SQL> select id from test_table where contains(text,'Hello\)World') > 0
2 /
ID
1
2
3
4
5
6
7
7 rows selected.
SQL> select id from test_table where contains(text,'Hello\[World') > 0
2 /
ID
1
2
3
4
5
6
7
7 rows selected.
SQL> select id from test_table where contains(text,'Hello\]World') > 0
2 /
ID
1
2
3
4
5
6
7
7 rows selected.
You need to add ()[] as printjoins:
SQL> begin
2 begin
3 ctx_ddl.drop_preference('test_lexer');
4 exception
5 when others then null;
6 end;
7 ctx_ddl.create_preference('test_lexer', 'BASIC_LEXER');
8 ctx_ddl.set_attribute('test_lexer', 'printjoins', '()[]');
9 end;
10 /
PL/SQL procedure successfully completed.
SQL> drop table test_table
2 /
Table dropped.
SQL> create table test_table (id number,text blob)
2 /
Table created.
SQL> insert into test_table values (1,utl_raw.cast_to_raw ('Hello World'))
2 /
1 row created.
SQL> insert into test_table values (2,utl_raw.cast_to_raw ('Hello(World'))
2 /
1 row created.
SQL> insert into test_table values (3,utl_raw.cast_to_raw ('Hello)World'))
2 /
1 row created.
SQL> insert into test_table values (4,utl_raw.cast_to_raw ('Hello[World'))
2 /
1 row created.
SQL> insert into test_table values (5,utl_raw.cast_to_raw ('Hello]World'))
2 /
1 row created.
SQL> insert into test_table values (6,utl_raw.cast_to_raw ('Hello([World'))
2 /
1 row created.
SQL> insert into test_table values (7,utl_raw.cast_to_raw ('Hello(_World'))
2 /
1 row created.
SQL> create index test_table_idx on test_table (text) indextype is ctxsys.context
2 parameters('lexer test_lexer')
3 /
Index created.
SQL> select id from test_table where contains(text,'Hello World') > 0
2 /
ID
1
SQL> select id from test_table where contains(text,'Hello\(World') > 0
2 /
ID
2
SQL> select id from test_table where contains(text,'Hello\)World') > 0
2 /
ID
3
SQL> select id from test_table where contains(text,'Hello\[World') > 0
2 /
ID
4
SQL> select id from test_table where contains(text,'Hello\]World') > 0
2 /
ID
5
SQL> SY. -
Using escape characters(\n,\t and etc) in JSP
Hi,
I need to format a jsp UI with out using any html code or CSS.
My end clients are having text based email utilities which does not support html or CSS. So I am generating a email template based on JSP by using session data for dynamic values.
Even though I am using escape char in the jsp it is not printing in new line. All information coming as a string in one shot with out formatting.
Code:
<%
footerContent.append("\r\nYou can visit the Store at");
footerContent.append(Global.getString("Store.Common.NewStoreURL"));
footerContent.append("If you have questions please email us at:"+Store.getContactInfo(GlobalConstants.EMAILADDDRESS)+"\r");
footerContent.append("or phone at "+Store.getContactInfo(GlobalConstants.PHONE));
%>
<%=footerContent.toString()%>Tried using with given code still its showing like below. Also I want to use "tab" for cart items display.
Code fragment:
<%@ page contentType="text/plain; charset=UTF-8" language="java"%>
some initialization code
<%="***********************************************************"%>
<%
StringWriter footer = new StringWriter();
PrintWriter pw = new PrintWriter(footer);
pw.println();
pw.print("You can visit the Store at " +store.getURL());
pw.println("If you have questions please email us at:"+store.getContactInfo());
pw.println("or phone Order Administration at "+store.getContactInfo());
pw.print("Monday through Friday"+store.getOfficeHours());
pw.println("Thank you for visiting"+Global.getStoreString());
String result = footer.getBuffer().toString();
%>
<%=result.toString()%>
<%="***********************************************************"%>
Out put :
"*********************************************************** You can visit the Store at @STORE_URL@If you have questions please email us at:[email protected] or phone Order Administration at 111 Monday through FridayMonday - Friday: 6:00 AM to 5:00 PM Pacific TimeThank you for visiting@COMPANY_URL@ *********************************************************** -
String with new lines in sql and java
i'm using mysql as my database. In one of the columns (nameCol) stores a string, 'hello, my name is earl'
In my java app i want to display this in a text area so that it looks like:
hello,
my name is earl
in mysql i did: INSERT INTO Table (......,nameCol) VALUES(.....,'hello,\nmy name is earl'); This inserted the data into the database in the format i wanted (as above) but when i printed it in my app it came out like hello, my name is earl.
My sample code:
//some code above to set a parameter for a select statement to get a unique row
//get data from the nameCol field ..this all works fine
String nameC = (String)nameDataProvider.getValue("Table.nameCol");
//set the text area
myTextArea.setText(nameC);Anyone know how i can get it to display in the format at the top?Well, one reason for that is that \n not necessarily leads to a line wrap. Wrap chars are system dependant. Try using System.getProperty("line.separator") instead.
-
Integration of PL/SQL and JSP (Java Server Pages)
I need to match a web application developed with PL/SQL with another developed in JSP (Java Server Pages) the problem is that the two apps interact with the same databese, an share de same users, I need to know how to get the user and password loged into pl/sql when the user want to use same of de .jsp pages running on another application server?
Hi Michael Vstling,
Did you try the java classes library (SDOAPI) that can be downloaded from OTN?
It may provide you with a better alternative when manipulating geometries in the Java space. There is an adapter in SDOAPI which can convert a JDBC STRUCT object into Java Geometry object defined in SDOAPI, and vice versa.
There are at least two ways in mixing PL/SQL and Java. The first one, as you mentioned, is to define your custom function in terms of PL/SQL and call it from within your Java program. With SDOAPI, you have the second option, which is to define your own functions in Java using SDOAPI and deploy them as Java stored procedures in db. You can then call them from within your PL/SQL code. In either way performance depends on a lot of things and generally it requires a "try and improve" approach.
About JPublisher and sdo_ordinate_array it may not be a spatial related problem. Did you try search the Java-related forums first?
LJ -
How to generate XML from relational data : PL/SQL or Java
I'm new to Oracle XML and would appreciate some advice. I've been asked to generate XML documents from data stored in relational tables. The XML documents must be validated against a DTD. We will probably want to store the XML in the database.
I've seen a PL/SQL based approach as follows :
1.Mimic the structure of the DTD using SQL object types 2.Assign the relational data to the object type using PL/SQL as required
3.Use the SYS_XMLGEN package to render the required XML documents from the SQL objects
However, creating the object types seems to be quite time consuming (step 1 above) for anything other than the simplest of XML documents.
I've also seen that there is the Java based approach, namely :
1. Use the XML generator to build Java classes based on a DTD.
2. Use these classes to build the required XML
On the face of it, the Java based approach seems simpler. However, I'm not that familiar with Java.
Which is the best way to proceed ? Is the PL/SQL based approach worth pursuing or should I bite the bullet and brush up my Java ?
Is it possible to use a combination of PL/SQL and Java to populate the dtd generated java classes (step 2 of the Java approach) to reduce my learning curve ?
Thanks in advanceTo help answer your questions:
1) Now, in 9iR2, you can use SQL/XML as another choice.
2) You can also use XSU to generate the XML and use XSLT to transform it to a desired format instead of using object views if possible.
3) XDK provide Class generator support to populate XML data to Java classes. -
Hello,
I have written a Java program that I want to call from a forms program. My form is written in the latest version of Oracle Forms Builder. My logic in the Java class is a common functionality that I want to use in many forms in my application. This functionality is written in Java because PL/SQL does not have functionality for that logic.
By the way, I have an additional question regarding PL/SQL and Java classes. Suppose I want to write common functionality that accesses my database with SQL statement. Which technology is best for performance? Is it Java or PL/SQL? My guess is PL/SQL?!I have now found the FORMS90_BUILDER_CLASSPATH in the registry. I have added my Jar file at the end of the FORMS90_BUILDER_CLASSPATH like this;
C:\OraHome_1\forms90\java\javacode.jar. Then I restarted my computer.
My javacode listed in the jar file is not available in the import java dialog in forms builder. Is there something else I should do? The only thing that I have done is the changes on the FORMS90_BUILDER_CLASSPATH. Maybe it is something in my Java code? My Jave code is an common Java class with only standard Java import statements. -
Bug with Show Whitespace and tab and space characters in SQL comments
If Preferences > Code Editor > Display > Show Whitespace Characters is checked, and I type the following in SQL Worksheet:
--A[tab]B[space]C
It renders with two spaces between B and C. The first one is a blank space without the light dot character used to signify a space character, and the second space is filled with the dot character. The caret is then blinking before the C instead of after it:
--A[tab]B[space][dot][|]C
Further selection actions and editing in the region produce "corrupted" results. I've tried changing fonts, but there was no change to the behavior. Multiple tabs before the B produce multiple blank spaces immediately after it, and when placed at the end of the line the caret is then shown another space to the left of the C:
--A[tab][tab]B[space][space][|][dot]C
If I turn off Show Whitespace Characters the rendering immediately corrects, and caret placement, selection action, and editing behaviors all work as expected.
This is observed on OS X with both the Mac OS X and Oracle/Fusion Blue look and feels.
Ian
About
Oracle SQL Developer 3.0.04
Version 3.0.04
Build MAIN-04.34
Copyright © 2005, 2011 Oracle. All Rights Reserved.
IDE Version: 11.1.1.4.37.59.31
Product ID: oracle.sqldeveloper
Product Version: 11.1.2.04.34
Version
Component Version
========= =======
Java(TM) Platform 1.6.0_24
Oracle IDE 3.0.04.34
Versioning Support 3.0.04.34
Properties
Name Value
==== =====
apple.awt.graphics.UseOpenGL false
apple.awt.graphics.UseQuartz false
apple.laf.useScreenMenuBar true
awt.nativeDoubleBuffering true
awt.toolkit apple.awt.CToolkit
class.load.environment oracle.ide.boot.IdeClassLoadEnvironment
class.load.log.level CONFIG
class.transfer delegate
com.apple.macos.smallTabs true
com.apple.mrj.application.apple.menu.about.name SQL_Developer
com.apple.mrj.application.growbox.intrudes false
file.encoding MacRoman
file.encoding.pkg sun.io
file.separator /
ftp.nonProxyHosts local|*.local|169.254/16|*.169.254/16
gopherProxySet false
ice.browser.forcegc false
ice.pilots.html4.ignoreNonGenericFonts true
ice.pilots.html4.tileOptThreshold 0
ide.AssertTracingDisabled true
ide.bootstrap.start 1309201485440911000
ide.build MAIN-04.34
ide.conf /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
ide.config_pathname /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
ide.debugbuild false
ide.devbuild false
ide.extension.search.path sqldeveloper/extensions:jdev/extensions:ide/extensions
ide.firstrun true
ide.java.minversion 1.6.0_04
ide.main.class oracle.ide.boot.IdeLauncher
ide.patches.dir ide/lib/patches
ide.pref.dir /Users/ibrandt/.sqldeveloper
ide.product oracle.sqldeveloper
ide.splash.screen splash.gif
ide.startingcwd "/Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin"
ide.user.dir /Users/ibrandt/.sqldeveloper
ide.user.dir.var IDE_USER_DIR
ide.vcs.noapplications true
ide.work.dir /Users/ibrandt/sqldeveloper
ilog.propagatesPropertyEditors false
java.awt.graphicsenv apple.awt.CGraphicsEnvironment
java.awt.printerjob apple.awt.CPrinterJob
java.class.path ../../ide/lib/ide-boot.jar
java.class.version 50.0
java.endorsed.dirs /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed
java.ext.dirs /Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext
java.home /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
java.io.tmpdir /var/folders/rq/rqQtue9lEpGAwCKh2hL8MU+++TM/-Tmp-/
java.library.path .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
java.naming.factory.initial oracle.javatools.jndi.LocalInitialContextFactory
java.protocol.handler.pkgs oracle.jdevimpl.handler
java.runtime.name Java(TM) SE Runtime Environment
java.runtime.version 1.6.0_24-b07-334-10M3326
java.specification.name Java Platform API Specification
java.specification.vendor Sun Microsystems Inc.
java.specification.version 1.6
java.util.logging.config.file logging.conf
java.vendor Apple Inc.
java.vendor.url http://www.apple.com/
java.vendor.url.bug http://bugreport.apple.com/
java.version 1.6.0_24
java.vm.info mixed mode
java.vm.name Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Sun Microsystems Inc.
java.vm.specification.version 1.0
java.vm.vendor Apple Inc.
java.vm.version 19.1-b02-334
jdbc.library /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/jdbc/lib/ojdbc6.jar
line.separator \n
log.file.name /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/extensions/oracle.datamodeler/log/datamodeler.log
mrj.build 10M3326
mrj.version 1060.1.6.0_24-334
oracle.home /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper
oracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG true
oracle.jdbc.mapDateToTimestamp false
oracle.translated.locales de,es,fr,it,ja,ko,pt_BR,zh_CN,zh_TW
oracle.xdkjava.compatibility.version 9.0.4
orai18n.library /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/jlib/orai18n.jar
os.arch x86_64
os.name Mac OS X
os.version 10.6.8
path.separator :
reserved_filenames con,aux,prn,lpt1,lpt2,lpt3,lpt4,lpt5,lpt6,lpt7,lpt8,lpt9,com1,com2,com3,com4,com5,com6,com7,com8,com9,conin$,conout,conout$
socksNonProxyHosts local|*.local|169.254/16|*.169.254/16
sqldev.debug false
sun.arch.data.model 64
sun.awt.exception.handler apple.awt.CToolkit$EventQueueExceptionHandler
sun.boot.class.path ../../rdbms/jlib/ojdi.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:
/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar
sun.boot.library.path /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries
sun.cpu.endian little
sun.cpu.isalist
sun.io.unicode.encoding UnicodeLittle
sun.java.launcher SUN_STANDARD
sun.java2d.ddoffscreen false
sun.jnu.encoding MacRoman
sun.management.compiler HotSpot 64-Bit Server Compiler
sun.os.patch.level unknown
svnkit.sax.useDefault true
user.country US
user.dir /Applications/Development/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin
user.home /Users/ibrandt
user.language en
user.name ibrandt
user.timezone America/Los_Angeles
windows.shell.font.languages
Extensions
Name Identifier Version Status
==== ========== ======= ======
Check For Updates oracle.ide.webupdate 11.1.1.4.37.59.31 Loaded
Code Editor oracle.ide.ceditor 11.1.1.4.37.59.31 Loaded
Component Palette oracle.ide.palette1 11.1.1.4.37.59.31 Loaded
Data Miner oracle.dmt.dataminer 11.2.0.1.10.109 Loaded
Database Connection Support oracle.jdeveloper.db.connection 11.1.1.4.37.59.31 Loaded
Database Object Explorers oracle.ide.db.explorer 11.1.1.4.37.59.31 Loaded
Database UI oracle.ide.db 11.1.1.4.37.59.31 Loaded
Diagram Framework oracle.diagram 11.1.1.4.37.59.31 Loaded
Diagram Javadoc Extension oracle.diagram.javadoc 11.1.1.4.37.59.31 Loaded
Diagram Thumbnail oracle.diagram.thumbnail 11.1.1.4.37.59.31 Loaded
Diff/Merge oracle.ide.diffmerge 11.1.1.4.37.59.31 Loaded
Extended IDE Platform oracle.javacore 11.1.1.4.37.59.31 Loaded
External Tools oracle.ide.externaltools 11.1.1.4.37.59.31 Loaded
File Support oracle.ide.files 11.1.1.4.37.59.31 Loaded
Help System oracle.ide.help 11.1.1.4.37.59.31 Loaded
History Support oracle.jdeveloper.history 11.1.1.4.37.59.31 Loaded
Import/Export Support oracle.ide.importexport 11.1.1.4.37.59.31 Loaded
Index Migrator support oracle.ideimpl.indexing-migrator 11.1.1.4.37.59.31 Loaded
JDeveloper Runner oracle.jdeveloper.runner 11.1.1.4.37.59.31 Loaded
JViews Registration Addin oracle.diagram.registration 11.1.1.4.37.59.31 Loaded
Log Window oracle.ide.log 11.1.1.4.37.59.31 Loaded
Mac OS X Adapter oracle.ideimpl.apple 11.1.1.4.37.59.31 Loaded
Navigator oracle.ide.navigator 11.1.1.4.37.59.31 Loaded
Object Gallery oracle.ide.gallery 11.1.1.4.37.59.31 Loaded
Oracle IDE oracle.ide 11.1.1.4.37.59.31 Loaded
Oracle SQL Developer oracle.sqldeveloper 11.1.2.04.34 Loaded
Oracle SQL Developer - 3rd Party Database Browsers oracle.sqldeveloper.thirdparty.browsers 11.1.1.04.34 Loaded
Oracle SQL Developer - DBA Navigator oracle.sqldeveloper.dbanavigator 11.1.1.04.34 Loaded
Oracle SQL Developer - Extras oracle.sqldeveloper.extras 1.1.1.04.34 Loaded
Oracle SQL Developer - File Navigator oracle.sqldeveloper.filenavigator 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Antlr3 Translator oracle.sqldeveloper.migration.translation.core_antlr3 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Application Migration oracle.sqldeveloper.migration.application 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Core oracle.sqldeveloper.migration 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations DB2 oracle.sqldeveloper.migration.db2 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations DB2 Translator oracle.sqldeveloper.migration.translation.db2 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Microsoft Access oracle.sqldeveloper.migration.msaccess 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Microsoft SQL Server oracle.sqldeveloper.migration.sqlserver 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations MySQL oracle.sqldeveloper.migration.mysql 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Sybase Adaptive Server oracle.sqldeveloper.migration.sybase 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations T-SQL Translator oracle.sqldeveloper.migration.translation.core 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Teradata oracle.sqldeveloper.migration.teradata 11.1.1.04.34 Loaded
Oracle SQL Developer - Migrations Translation UI oracle.sqldeveloper.migration.translation.gui 11.1.1.04.34 Loaded
Oracle SQL Developer - Object Viewer oracle.sqldeveloper.oviewer 11.1.1.04.34 Loaded
Oracle SQL Developer - Real Time SQL Monitoring oracle.sqldeveloper.sqlmonitor 11.1.1.04.34 Loaded
Oracle SQL Developer - Reports oracle.sqldeveloper.report 11.1.1.04.34 Loaded
Oracle SQL Developer - Scheduler oracle.sqldeveloper.scheduler 11.1.1.04.34 Loaded
Oracle SQL Developer - Schema Browser oracle.sqldeveloper.schemabrowser 11.1.1.04.34 Loaded
Oracle SQL Developer - SearchBar oracle.sqldeveloper.searchbar 11.1.1.04.34 Loaded
Oracle SQL Developer - Snippet oracle.sqldeveloper.snippet 11.1.1.04.34 Loaded
Oracle SQL Developer - Spatial oracle.sqldeveloper.spatial 11.1.1.04.34 Loaded
Oracle SQL Developer - TimesTen oracle.sqldeveloper.timesten 2.0.0.04.34 Loaded
Oracle SQL Developer - Tuning oracle.sqldeveloper.tuning 11.1.1.04.34 Loaded
Oracle SQL Developer - Unit Test oracle.sqldeveloper.unit_test 11.1.1.04.34 Loaded
Oracle SQL Developer - User Extensions Support oracle.sqldeveloper.userextensions 11.1.1.04.34 Loaded
Oracle SQL Developer - Worksheet v2 oracle.sqldeveloper.worksheet 11.1.1.04.34 Loaded
Oracle SQL Developer - XML Schema oracle.sqldeveloper.xmlschema 11.1.1.04.34 Loaded
Oracle SQL Developer Data Modeler oracle.datamodeler 3.0.0.665.2 Loaded
Oracle SQL Developer Data Modeler - Reports oracle.sqldeveloper.datamodeler_reports 11.1.1.04.34 Loaded
PROBE Debugger oracle.jdeveloper.db.debug.probe 11.1.1.4.37.59.31 Loaded
Peek oracle.ide.peek 11.1.1.4.37.59.31 Loaded
Persistent Storage oracle.ide.persistence 11.1.1.4.37.59.31 Loaded
Property Inspector oracle.ide.inspector 11.1.1.4.37.59.31 Loaded
QuickDiff oracle.ide.quickdiff 11.1.1.4.37.59.31 Loaded
Replace With oracle.ide.replace 11.1.1.4.37.59.31 Loaded
Runner oracle.ide.runner 11.1.1.4.37.59.31 Loaded
VHV oracle.ide.vhv 11.1.1.4.37.59.31 Loaded
Versioning Support oracle.jdeveloper.vcs 11.1.1.4.37.59.31 Loaded
Versioning Support for Subversion oracle.jdeveloper.subversion 11.1.1.4.37.59.31 Loaded
Virtual File System oracle.ide.vfs 11.1.1.4.37.59.31 Loaded
Web Browser and Proxy oracle.ide.webbrowser 11.1.1.4.37.59.31 Loaded
XML Editing Framework IDE Extension oracle.ide.xmlef 11.1.1.4.37.59.31 Loaded
audit oracle.ide.audit 11.1.1.4.37.59.31 Loaded
classpath: protocol handler extension oracle.jdeveloper.classpath 11.1.1.0.0 Loaded
jdukshare oracle.bm.jdukshare 11.1.1.4.37.59.31 Loaded
mof-xmi oracle.mof.xmi 11.1.1.4.37.59.31 Loaded
oracle.ide.dependency oracle.ide.dependency 11.1.1.4.37.59.31 Loaded
oracle.ide.indexing oracle.ide.indexing 11.1.1.4.37.59.31 Loaded
palette2 oracle.ide.palette2 11.1.1.4.37.59.31 Loaded
status oracle.ide.status 11.1.1.4.37.59.31 Loadedare you using an "Expert Mode" query or not?
With normal mode, the query is stored in an XML attribute.
With expert mode, it's stored in a CDATA Section, which allows it to respect all user-spacing and newlines.
XML attribute values are forced by the XML 1.0 spec to be normalized, and this is done by the parser when they are read in. That might account for your different in space treatment.
Maybe you are looking for
-
Can we have a tooltip text, formatted on 2 and more rows
Hello, I am interested if it is possible (in List GUIBB) to make a tooltip(on a list cell), containing additional description, formatted on 2 and more rows like bulleted list. As I can see the "tooltip" field in the fields description(parameter struc
-
Photos taken with back camera have black spot like having stain on back camera. however, back camera was complete clean! Help needed. Still under warranty!
-
hello everybody is possible to hide Windows taskbar with a Java application? how?
-
Recommended JVM Parameters for Master and ClientManager (v 6.1.0)
What are the recommened JVM parameters for a master and client manager running on the same Linux machine? Current VM Specs: OS: Suse Linux Processor Count: 4 Physical Memory: 8GB Using Java: jdk1.6.0_13 Current Master Params: JVMARGS=-Xms2048m -Xmx20
-
Computers in cluster spending all their CPU time with system; many questio
I'd be interested to know if anyone on the list has been successful in getting QMaster to work on a home network of G4 computers, 800 - 867 MHz, NO server, 100 mbps hubs, existing CAT5 wiring violates the radius recommendations for 100 mbps. At one p