Spatial Java (JDBC/SQLJ)

hi
How can i convert the mdsys.sdo_geometry data type into Java?
I use sdo_geom.sdo_poly_differnce the result is a Object from data type mdsys.sdo_geomtry. Now i wan't to calculate the area (sdo_geom.sdo_area) from this Object. How can i do this?
THX

Steffen,
You can use the SDOAPI library. Have a look in http://technet.oracle.com/products/spatial to download the relevant files. There are some useful examples included in the distribution which will save you time (trust me).
Good Luck

Similar Messages

  • JAVA JDBC code for Oracle 9i

    I need java jdbc code for oracle 9i as soon as possible.

    All the information you need is on the web. For some of it, you'll need to register with Oracle. It's free and they don't send annoying emails (at least to me).
    Sample code:
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/index.html
    Code templates:
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/htdocs/templates.htm
    Oracle JDBC FAQ:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
    Oracle9i JDBC Developer's Guide and Reference (for 9.2)
    http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/toc.htm
    Oracle general documentation
    http://www.oracle.com/technology/documentation/index.html
    Oracle SQLJ/JDBC forum
    http://forums.oracle.com/forums/forum.jspa?forumID=99

  • Passing parameters from java jdbc to pl/sql

    I’m calling stored procedures from java jdbc… but looking for nicer interfaces in terms of passing data. Has anyone come up with a good way to pass data from java jdbc to pl/sql without passing a million parameters? I’m thinking here of some type of structure like pl/sql rowtype or table index type or something else. Has anyone tried to create typed objects in oracle databases and access them from java?
    Thanks, Patrick Caldwell

    Hi Patrick,
    Yes, I have created an Oracle object type, which I successfully returned to a java class, from a PL/SQL stored function, using JDBC. Environment was J2SE 1.3.1, with Oracle 8.1.7.4 on SUN [sparc] Solaris 7 with Oracle's JDBC (thin) driver. It was a while ago, so I don't remember the details very clearly, but I recall being able to figure it out quite easily using the Oracle documentation and the sample code available at Oracle's Technet Web site.
    Hope this has helped you.
    Good Luck,
    Avi.

  • How To Store pdf or doc file in Oracle Database using Java Jdbc?

    can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.

    Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
    for Adding PDF in DB i used image.jsp
    Database table structure (table name. pictures )
    Name Null? Type
    ID NOT NULL NUMBER(11)
    IMAGE BLOB
    <%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
         PreparedStatement ps,pstmt,psmnt;
         ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =
    new File("D:/info.pdf");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,4);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("<h2>PDF inserted successfully");
    else{
    out.println("<h2>Problem in image insertion");
    catch(Exception e){
    out.println("<h2>Failed Due To "+e);
    %>
    O/P: PDF inserted successfully
    i tried to display that pdf using servlet. i am giving the code below.
    import java.io.IOException;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class DispPDF extends HttpServlet {
         * The doGet method of the servlet. <br>
         * This method is called when a form has its tag value method equals to get.
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              //response.setContentType("text/html"); i commented. coz we cant use response two times.
              //PrintWriter out = response.getWriter();
              try{
                   InputStream sPdf;
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
                        PreparedStatement ps,pstmt,psmnt;
                   psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
                        psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
                   ResultSet rs = psmnt.executeQuery();
                        if(rs.next()) {
                   byte[] bytearray = new byte[1048576];
                        //out.println(bytearray);
                        int size=0;
                        sPdf = rs.getBinaryStream(1);
                        response.reset();
                        response.setContentType("application/pdf");
                        while((size=sPdf.read(bytearray))!= -1 ){
                        //out.println(size);
                        response.getOutputStream().write(bytearray,0,size);
                   catch(Exception e){
                   System.out.println("Failed Due To "+e);
                        //out.println("<h2>Failed Due To "+e);
              //out.close();
    OP
    PDF-1.4 %âãÏÓ 2 0 obj <>stream xœ+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2‹ŠKüsSŠSŠS4C²€ê P”kø$V㙂GÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
    plz help me out.

  • How to call pl/sql that is included with FND call in java jdbc directly?

    in my case, I want to call my procedure that will call EBS FND procedure in java jdbc thin way.
    Actually I can run this procedure in sqlplus very well, but I can't run it in my java code, I found that is caused by FND_GLOBAL.APPS_INITIALIZE. In my opinion, the procedure should be running in same server side, I am confused why the procedure has different way in the client side such as jdbc or sqlplus?
    does anyone use pure jdbc thin to call EBS FND procedure directly, instead of AOLj? Thanks in advance

    before you run any oracle apps APIs you need to set environment.....n environment settings will be done by FND_GLOBAL.APPS_INITIALIZE API.
    From which java application you need to call FND Proc....
    whts the basic requirement ?

  • Trying to connect to Sybase with Java jdbc

    Hoping someone can help me to connect to Sybase database (version is Sybase Adaptive Server Enterprise 12.5.3). I am using a technique I read that worked with Access and adapting by some examples for Syabase I found on the web but keep getting errors. Below is my code with some of the examples Ive been using commented out.
    I have created a DSN on my Windows Xp o/s named GPTS_SYBASE via ODBC Use DSN set-up wizard, driver is Sybase ASE ODBC Driver.
    import java.sql.*;
    public class DBConn {
    public DBConn(){
    public static void main(String[] args) {
    try {
    //Class.forName("com.sybase.jdbc2.jdbc.SybDriver.class.getname()");
    //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
    String sourceURL = "jdbc.odbc.GPTS_SYBASE";
    //String sourceURL = "jdbc.sybase.Tds:GPTSPSYB1:5000/gpts";
    Connection conn = DriverManager.getConnection(sourceURL, "gptsdbo", "gptsdbo");
    //Connection conn = DriverManager.getConnection(sourceURL);
    System.out.println("Success");
    } catch (Exception e) {
    System.err.println("Got an excpetion! ");
    System.err.println(e.getMessage());
    Error message from this code is
    Got an excpetion!
    com.sybase.jdbc2.jdbc.SybDriver

    Have you read the Sybase docs or the Java JDBC docs? ODBC != JDBC. They sound the same but are totally different. The DSN is totally irrelevant for type 4 JDBC drivers.
    It would help to actually print the stack trace by changing your code to:
    catch (Exception e) {
        System.err.println("Got an excpetion! ");
        e.printStackTrace();
    }Also, you're mixing the wrong class name with the URL. You need "com.sybase.jdbc2.jdbc.SybDriver" and, in your case jdbc:sybase:Tds:GPTSPSYB1:5000/gpts - note the change to colons, not periods! - when in doubt read the docs!

  • Can I connect to Oracle server7.1  through Java-JDBC using the latest thin drivers???

    Hey Gurus,
    Please help me .
    MY Current requirement is to connect to multiple oracle 7.1( and other variants) servers running on different operating systems, through Java/JDBC.
    My FIrst question is, can i connect to older versions of database using latest drivers?
    I could connect to the server running on SCO-oracle 7.1 using SQLNet8.1.7 under windows. But the same is not happening when the client is on Linux.But I need to connect from linux
    It says ORA-03113 - End of communication channel.
    What may be th problem.
    If any one could show some pointers where I can get more information about this problem would be helpfull
    THanks
    Lokesh

    I tried the classpath suggestion above (not the one modifying the .xml file) , but it didnt work for me , I am using WLI 10.3.1 and trying to connect DB on 8.1.7 V . I downloaded the classes12.jar and the ojdbc14.jar file from the oracle and placed in lib and the even included the classpath , but i again got the same exception .
    All this while i was selecting the option Oracle Driver Thin from the DataBase Driver when creating the connection pool from console . I tried with "BEA Oracle Driver (Type 4)" and it worked for me .. Although the option "BEA Oracle Driver (Type 4)" lists only the DBs from 9.0.1 to 11 G , but in my case using this driver i am able to connect to Oracle DB 8.1.7 . So all you guys if it classpath doesnt fix the issue try out by selecting Driver , "BEA Oracle Driver (Type 4)" .
    Manoj , this will fix the Connection pool part of the ques, but for the java part Try to load the Driver class "weblogic.jdbc.oracle.OracleDriver" before connecting to DB with Class.forName.
    Thx
    Yatin Mehta

  • Newbie: Java/JDBC best approach

    Hello, i am having trouble understanding the best approach to develop java/jdbc programs.
    I was told that the i could best load resultset data in to value objects loaded into a vector
    and handled by data access objects instead of using the resultset directly.
    This method should give me more flexibility when navigating, inserting, updating and
    deleting rows.
    An example is given by Matthew Robinson and Pavel Vorobiev in their book
    (http://manning.spindoczine.com/sbe/).
    So i am desperately seeking for sample code or documentation on this matter.
    Matthew Robinson and Pavel Vorobiev do not give a full solution containing r/w/u
    functionality.
    When seeking on the web i find only references to J2EE and this would be
    overkill for the applications i have in mind at this moment.
    I am afraid i will re-invent the wheel and end up with a square one.
    Therefore in short my questions:
    1. Should i use and manipulate the (scrollable, updatable) resultset or use
    value objects handled by data access objects.
    2. Where can i find sample code or documentation on this matter (not J2EE).
    I would be very gratefull if someone could help me,
    Rob

    Hi,
    Contact me at [email protected] I will be able to help you... and provide some sample code.
    regards,
    Nish

  • [Q] Oracle Spatial Java Class Library: classes missing ?

    Hello !
    We are using Oracle 9.2.0.4 with Spatial features and we'd like to use the Java Library to get access to the object Geometries. We have downloaded the Spatial Java Library at:
    http://www.oracle.com/technology/software/products/spatial/index.html
    The "sdo_java_040319.zip" file contains "sdoutl.jar", "sdotopo.jar, "sdonm.jar" and "sdoapi.jar". *BUT* "sdoapi.jar" only contains the "oracle.spatial.geometry.JGeometry" class !
    Nothing about the "oracle.sdoapi.*",
    "oracle.sdoapi.geom", "oracle.sdoapi.adapter", ...
    "oracle.sdoapi.sref" !
    Where are they ?
    Thank you for your replies

    The JGeometry class is it.
    It's all you need with the new, supported sdoapi.
    The javadoc for JGeometry has an example of its usage.

  • BI Java JDBC connector problem

    Hi friends,
          Our BW 3.5 system is working on win2003 with ms-sql db with sp10/J2EE 6.40 with SP8. When try to configure BI java jdbc driver it is giving following error in IE
    java.lang.ClassFormatError: com/sap/ip/bi/sdk/trialarea/connector/servlet/TestJdbc630 (Bad magic number)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at com.sap.engine.services.deploy.server.ApplicationLoader.defineClassWithInterception(ApplicationLoader.java:168)
         at com.sap.engine.services.deploy.server.ApplicationLoader.loadLocalClass(ApplicationLoader.java:140)
         at com.sap.engine.frame.core.load.ResourceLoader.loadClass(ResourceLoader.java:143)
         at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:303)
         at com.sap.engine.services.servlets_jsp.server.runtime.context.WebComponents.getServlet(WebComponents.java:306)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:121)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    anybody could help me resolving this?
    Thanks,
    Krishna

    Scott,
           Thanks for your prompt reply. I done the configuration based on doc u refered to me. But still getting the same error in browser. This is the link
    https://qbiwd1:50200/tjdbc/servlet/testjdbc I am entering into the brower. Following error persisting
    java.lang.classformaterror: com/sap/ip/bi/sdk/trialarea/connector/servlet/TestJdbc630 (Bad magic number)
    For your information I upgraded J2EE engine from 6.30 sp3 to 6.40 sp8
    Is error might be related with "TestJdbc630" file?
    Your help would be greatly appreciated
    Thanks,
    Krishna

  • Are Oracle spatial java libraries redistributable?

    Hi,
    Do you have any idea about Oracle's policy on distributing Oracle Spatial Java Class Libraries? Can our software that is targeted for commercial purpose distribute it?
    We are using these SDO java libraries.
    oracle_sdo.jar
    sdoapi.jar
    sdogr.jar
    sdonm.jar
    sdotopo.jar
    sdoutl.jar
    Also if redistribution is not allowed, can our users having Oracle DB license, copy these libraries from their Oracle DB machine to the machine where our product is installed.
    Please guide us to appropriate web link on this topic. We could not get clear information by going through Oracle sites.
    Thanks in advance,
    Subrahmanyam.

    Go to: http://www.oracle.com/technology/software/products/spatial/index.html
    Then click one of the downloads and you get the "Oracle Technology Network Development and Distribution License Terms". The second box covers the distribution license.
    I'm sure that its covered in there .... Lots of Legal Mumbo-Jumbo ...... But it contains this line:
    "You may also distribute the programs with your applications to your customers."
    So it looks like "Yes" is the answer to your question !
    Ro

  • Oracle Database 2003 Beta Program: new JDBC/SQLJ/JPublisher features

    We are currently recruiting for the Oracle Database 2003 Beta Program, including new JDBC/SQLJ/JPublisher features. To learn more about this program, including how to apply, send me an email @ [email protected]
    Kuassi Mensah

    I suppose that is nice.
    It would be even nicer if the drivers actually conformed to JDBC so that one could for example reliably use blobs in a J2EE server with CMP.

  • Oracle Spatial Java Class Library Download?

    Hello,
    where can I download the Oracle Spatial Java Class Library? I installed OracleXE which can handle SDO_GEOMETRY types and now need the java library for programming against the database.
    greetings
    Peter

    If you mean by samples that show you how to manipulate Geometry types than you can find this tutorial using java and connecting to your DB via Oracle Spatial Network Data Model (NDM) https://spatial.samplecode.oracle.com/servlets/ProjectProcess?pageID=0Zl7oV
    My personal experience, it would be good idea to have oracle 11g Release 2 installed.
    It shows you different ways to query spatial data. You might also be interested in this documentation on oracle Topology and NDM Developers guide: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28399.pdf

  • Doubt handling Clob columns with Java JDBC api

    Hi,
    we have a doubt handling Clob columns with Java JDBC api.
    Reading Oracle 10g official documentation (document b10979.pdf, page 236), we found this note:
    ============================================
    To write LOB data, the application must acquire a write lock on the LOB object. One way to accomplish this is through a SELECT FOR UPDATE. Also, disable auto-commit mode.
    ============================================
    We also found a java sample code about how to handle Lob objects at this URL:
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSample/LOBSample.java.html
    In our java2 application, we access Clob objects in a quite different
    manner: we use normal setString() and getString() methods, as described into paragraph "Shortcuts For Inserting and Retrieving CLOB Data"
    (document b10979.pdf, page 244).
    Using those methods, we never lock the table row by a SELECT FOR UPDATE statement (as described into the note above). We use simply SELECT, UPDATE and INSERT prepared statement.
    In this way we can insert both clob objects and normal timestamp, number and other types with a single insert statement. Idem for update.
    To recap, our question is:
    Is it mandatory to create a SELECT FOR UPDATE statement when updating clob data? What may be the consequences if we don't use it? It is also correct to insert with a single sql statement both clob and not clob data using the setString() method for the clob types? And more than one lob column in the same record?
    bye,
    luca acri.

    And columns of type FLOAT. These also have, for some unknown reason a metadata type of OTHER, and a type string of 'FLOAT'. Yet PreparedStatement.setNull(x, Types.OTHER) doesn't work and setNull(x, Types.DECIMAL) does.

  • Need to view JAVA + JDBC + HSQLDB in action!

    Someone knows where can I find examples/codes of Java + JDBC + HSQLDB? Such as programs that use all of them and put some GUI to manage the data?
    Thanks a lot!

    http://hsqldb.org/

Maybe you are looking for

  • FFX file preview with Adobe Bridge

    Hello all, I did post a similar thread in the Adobe Bridge Forum but I thought that possibly the AE comunity may understand my problem a little better. I wanted to begin learning After Effects CS4, unfortunately Adobe Bridge CS4 is halting my educati

  • How to delete photos from my Photo Stream?

    I have read the article at http://support.apple.com/kb/HT5125?viewlocale=en_US&locale=en_US  I have followed the steps to remove photos from iPhoto on my MacBook Pro.  That worked.  The same photos did not get deleted from my iPhone and for my iPad.

  • Strange problem with loading pages.

    With little warning, my Firefox began to act strangely. When I would attempt to load or refresh a page, it would not respond. The tab would show the loading animation, but it would be frozen. Confused, I began to move my mouse to try and figure out w

  • Trouble with a PDF opening correctly from a link

    When I click the link to a certain pdf on a web page, a new window opens but I get the error message "The file is damaged and could not be repaired." I click OK, then close that window. I go back to the link, click on it again, and sometimes the pdf

  • How to deliver a paramter to the viewobject with jsf

    I use hr schema to learn adf bc component.but i want to use jsf #{param.region} to get the parameter from the urls and deliver it to the viewobject and last show the list table on the jsf page in the viewoject xml sql : select a,b,c,d... from xxxview