Java in oracle database
Hi all..
Database Version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
I have the following pl/sql wrapped java code in one my package.
How can i see the "'actual java code"" that it is calling.
I found this is the class name "com.test.qm.archive.exec" that it is calling, but i couldn't find where can i see the actual java code.
Please help me with it.
{code}
FUNCTION archive_java(i_from IN VARCHAR2,
i_to IN VARCHAR2,
i_pipedir IN VARCHAR2,
i_holdx IN DATE,
i_keepx IN DATE,
i_forcepurge IN NUMBER)
RETURN string_array
AS language java
name 'com.test.qm.archive.exec(java.lang.String,
java.lang.String,
java.lang.String,
java.sql.Date,
java.sql.Date,
boolean) return oracle.sql.ARRAY' ;
{code}
Assuming that PL/SQL Developer doesn't display Java stored procedures...
The Java source is not stored in the file system. It is stored somewhere in the data dictionary. I couldn't tell you how to extract the source from the data dictionary, though. It's not as simple as grabbing the source from DBA_SOURCE. You might ask over in the Java Stored Procedure forum. The folks over there may be more familiar with the Java stored procedure data dictionary views.
Personally, I'd tend to just grab SQL Developer and/or grab the source from your source control system.
Justin
Edited by: Justin Cave on Mar 12, 2013 3:21 PM
Similar Messages
-
How to connect Java to oracle Database Express Edition?
Anyone can help me?
How to connect JAVA TO ORACLE DATABASE EXPRESS EDITION?I suggest you to read this article:
http://wiki.oracle.com/page/JDBC
Regards,
Ricky -
Problem with Java and Oracle Database - help !
i keep getting a NullPointerException when trying to
update a resultSet in a servlet. i am bringing in the data
just fine from an Oracle database. but it chokes when trying
to update it. can anybody tell me what is happening?
thanks for any help
Owen
ResultSet rs = stmt.executeQuery( "select * from sw_assets" );
rs.next();
rs.updateString("name","XXX"); <--- BOOM !
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcBoundCol.setRowValues(JdbcOdbcBoundCol.java:240)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateChar(JdbcOdbcResultSet.java:3767)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateString(JdbcOdbcResultSet.java:3257)
at sun.jdbc.odbc.JdbcOdbcResultSet.updateString(JdbcOdbcResultSet.java:3848)
at _0002fopen_0002ejspopen_jsp_3._jspService(_0002fopen_0002ejspopen_jsp_3.java:87)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)ResultSets based on a wildcard are generally treated as views by Oracle, meaning they are not updatable no matter how you create your statement. Try either "select swa.* from sw_assets swa" or "select all from sw_assets swa", that should get around the problem.
Also (just being thorough) make sure that you specifically created your statement as being updatable (stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) ).
I would not normally expect a NullPointerException when encountering this "feature", but then I don't often use the ODBC bridge.
Good luck! I hope this helps. -
Java certification & oracle database administrator certification
Hello,
On this page i can see all certification paths. But when i logged into my account, on pearsonvue.com, i issued 'Schedule an exam'. But there i can't find any java certification or oracle database administration certifications. So where can i find all the certifications for scheduling, shown on that page?
ThanksRoger22 wrote:
Hello,
On this page i can see all certification paths. But when i logged into my account, on pearsonvue.com, i issued 'Schedule an exam'. But there i can't find any java certification or oracle database administration certifications. So where can i find all the certifications for scheduling, shown on that page?
Thanks1) You need to drill down from that link to find individual exams ... eg 1z0-051, 1z0-052, etc ... for instance via:
http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=198&p_org_id=&lang=
http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_052
2) You may need to register on Pearson VUE particularly for Oracle.
(Prometric works much on on a one registration does all, Pearson VUe requires registration for each vendor, in general as far as I remember). But I was able to use my LPIC registered Pearson VUE for Oracle
To begin with ensure you go via http://www.pearsonvue.com/oracle/
3) Java exams, having come from Sun stewardship, are currently via Prometric.
See the Sun Transition FAQ (which is now VERY hard to locate unless you know what you are looking for!)
http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=82#6Q12C -
Reports from Java and Oracle database
Hi
I need to generate couple of reports from my application, with Java as front end and oracle 11.2.0.3.0. database . Reports are having very simple select statements, using the criteria users enter from GUI. we don't need to execute a direct select statement from Java, with the where clauses . I did some research and found out about Pipelined functions. I tested for a small set of records and it worked fine. Will this work for large data set? any drawbacks of using this method? Any other methods for this requirement?
Thanks in advance
JPPipeline table functions do not sound like the appropriate approach. It is designed to primarily deal with data transformations. Using it as a rendering engine for report writing? There are fundamental problems with such an approach.
As Dave and Andre commented - the CORRECT means for PL/SQL to pass "data" to Java (or other client languages) is via reference cursors (pointers that the client can use for referencing SQL cursor programs on the server). And Java as a report writer does not really compare with the ease and flexibility that Oracle Apex (Application Express) provides as a reporting framework. -
Noclassfound error while connecting java with oracle database
hi all
the source code metioned below gets compiled. but when it is run
it gives thefollowing error.
ClassNotFoundException: jdbc.driver.OracleDriver
Exception in thread "main" java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at pract.main(pract.java:16)
import java.sql.*;
class pract
public static void main (String args []) throws SQLException
try
Class.forName("jdbc.driver.OracleDriver");
catch(java.lang.ClassNotFoundException e)
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@anant:1521:student", "scott", "tiger");
// @machineName:port:SID, userid, pas
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select * from emp");
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
stmt.close();
i have included the following driver classes in the classpath
ojdbc.jar,
ojdbc_g.jar,
classes111.jar
but still im unable to connect.
can anyone help me in solving this simple problem.hi ,
you hav not stated which oracle ur using...still if u r using oracle 9i then u hav to include classes12.jar file in ur lib build classpath and then tryout following changes in code....
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@<host>:<port>:<sid>","scott","tiger");
hope this ll help.... -
What is Oracle database current Java version
How do tell what version of Java my Oracle database is using.
I check select * from dba_registery, but no luck; I know the latest java version is 1.6.Here is what they have below, but when I execute the sql, it hung and have to cancel:
create or replace procedure java_props
as language java name 'props.show_props()';
show errors
connect / as sysdba
exec dbms_java.grant_permission( 'SCOTT','java.util.PropertyPermission','*','read,write');
commit;
connect scott/tiger
set serveroutput on size 10000
exec dbms_java.set_output(10000)
exec java_props -
How to connect java with oracle
can any body show me the code of how to connect java with oracle database.
thank youTo configure Oracle JDBC:
1. Add Oracle JDBC JAR file classes12.zip or ojdbc14.zip to classpath.
2. Load and register the JDBC driver.
Class.forName("oracle.jdbc.driver.OracleDriver");
3. Obtain a connection:
String url="jdbc:oracle:thin:@<host>:1521:<database>
Connection con = DriverManager.getConnection(url,
"myLogin", "myPassword");
4. Create a SQL statement.
Statement stmt = con.createStatement();
5. Obtain a result set.
ResultSet rs = stmt.executeQuery(
"SELECT ..."); -
How to load a java script in oracle database
Is it possible to load d java script in Oracle database. while the object type is
java resource ..RENUJP wrote:
I meant to load a javascript to oracle database not to oracle appliocation.
like loadjava....
I can load a javascript to oracle database.. but i can't call it...Please re-read the comments above, especially the part about this not being a javascript nor oracle forum. Exactly what part about this information don't you understand? -
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Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü 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. -
Installation oracle database 10.2 on mac snow leopard server JAVA ERROR
When I try install DB 10g in my Macbook Pro with Snow leopard show this error when I try the 'installer' :
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-11-18_08-45-47PM. Please wait ...The Java RunTime Environment was not found at /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java. Hence, the Oracle Universal Installer cannot be run.
Please visit http://www.javasoft.com and install JRE version 1.3.1 or higher and try again.
: No such file or directory
logout
Please help me its urgent !
Thanks
Best RegardsWelcome to the forums !
For urgent issues, pl open a Service Request with Support at http://support.oracle.com
The forums are a loose organization of unpaid volunteers and cannot support urgent issues ;-)
AFAIK, Snow Leopard has not been certified for 10g yet.
Pl confirm that you meet all of the requirements for the install - http://download.oracle.com/docs/cd/B19306_01/install.102/b25286/toc.htm
See related thread Re: Install Oracle Database 10g on Mac OS X Snow Leopard
HTH
Srini -
Build gui for existing oracle database tables with webdynpro java?
hi
i want to build a GUI to maintain existing oracle tables
so far we used oracleFORMS to do so
is there a good approach for webdynpro java? or do you recommend other sap tools?
can we generate the gui with a wizard based on the fields in the table?
do we have to generate sql statements or type in manually?
regards
joergHi Joerg,
generally that is possible, but you'll have to implement the data access by yourself, by means of EJB or another Java persistance framework such as JDO, SQLMaps, Hibernate, whatever...
Web Dynpro allows to build a GUI based upon a model - in this case this could be some POJOs (DTOs) representing your database tables, which are communicated to the GUI by your data access layer. Consider a model as a simple Java bean representing database data.
This approach would require to build a data access layer which incorporates manually generated sql statements, so you'll have to have expert database and java knowledge.
There might be other approaches, this is just to demonstrate one working possibility.
regards,
Christian -
Problem when connecting locally to Oracle Database 10g from Java code
Good afternoon,
I try to connect to my local Oracle 10g from JAVA code. Could somebody tells me what are the 'values' to enter in place of 'value1, value2, value3' in the following:
final String connectionURLThin = "jdbc:oracle:thin:@value1:value2:value3";
I tried to put my 'user' and 'pw' credentials I used when connecting with SQL*PLUS:
value1=my_user_name
value2=my_pw
value3=my_schema
but it doest work. Besides where could have I to put the 'WORKSPACE" name?
Thanks for any help.
Claude
Details:
ERR MESSAGE----------------------
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/instrument/ExecutionContextForJDBC
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:365)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:854)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:200)
at javaapplication6.ConnectionExample.driverManager(ConnectionExample.java:138)
at javaapplication6.Main.main(Main.java:36)
Caused by: java.lang.ClassNotFoundException: oracle.dms.instrument.ExecutionContextForJDBC
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
... 8 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
---------------------ERR MESSAGE
JAVA code------------------it compiles but throw an error when running there -> (*)...
final String driverClass = "oracle.jdbc.driver.OracleDriver";
final String connectionURLThin = "jdbc:oracle:thin:@jeffreyh3:1521:CUSTDB";
final String userID = "scott";
final String userPassword = "tiger";
final String queryString = "SELECT" +
" user " +
" , TO_CHAR(sysdate, 'DD-MON-YYYY HH24:MI:SS') " +
"FROM dual";
public void driverManager() {
Connection con = null;
Statement stmt = null;
ResultSet rset = null;
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection(connectionURLThin, userID, userPassword); // (*) prob here
stmt = con.createStatement ();
rset = stmt.executeQuery(queryString);
rset.close();
stmt.close();
} catch (SQLException e) {e.printStackTrace();
--------------------JAVA JDK 1.6
My system ------------------------
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - ProductionYes, the network connection could not be established. Like the error said.
What you're asking about is the exact reason, but that could be any number of things and not at all related to code. You could have the wrong host, the wrong port. A firewall could be blocking the outgoing connection, a firewall could be blocking the incoming connection. Etc. etc. -
Connecting to Oracle database in Java using TNSNAMES.ora
I have a program that can connect to both MSSQL and Oracle databases. It works fine when a user has defined an odbc connection, however if the user only has a tnsnames.ora, I don't know how to code the program in Java to connect to the database. I can't hard-code the server name because I don't know the database up front - I need to be able to read tnsnames.ora to get the information instead. How can I get this information? So far, the object OracleDataSource seems to be getting me the closest, however I am still failing to connect.
In 10.2, JDBC-Thin supports TNSNAMES entries lookup in tnsnames.ora, resulting in a much simplified and driver type independent Oracle Net descriptor. You must set the system property oracle.net.tns_admin to the directory that contains your tnsnames.ora file.
See the Oracle JDBC 10.2 doc.
Here is a code fragment from my book (see my blog below)
java -Doracle.net.tns_admin=$ORACLE_HOME/network/admin
or:
System.setProperty("oracle.net.tns_admin", "c:\oracle\net\admin");
OracleDataSource ods = new OracleDataSource();
ods.setTNSEntryName("tns_alias");
ods.setUser("scott");
ods.setPassword("tiger");
ods.setDriverType("thin");
Connection conn = ods.getConnection();
Kuassi - blog http://db360.blogspot.com/ -
Oracle Database Express Edition 2 Day Plus Java Developer Guide??
I posted in the JDeveloper forum, as well as sending email via your feedback link found on the tutorial but I am a little disappointed by this:
The Oracle® Database Express Edition 2 Day Plus Java Developer Guide has some errors in it.
in Windows, I simply chose, start
-> programs -> Oracle Database Express Edition -> Go To Database Home Page -> click documentation from the link -> and run the Oracle® Database Express Edition 2 Day Plus Java Developer Guide tutorial.
the problem is there are mistake(s) in the tutorial, for example: section 4-19 is this:
"The complete code for the method should now be as follows:
public boolean authenticateUser(String userid, String password,
HttpSession session) throws SQLException { "
it needs to be this:
public boolean authenticateUser(String jdbcURL, String userid, String password,
HttpSession session) throws SQLException {
Also:
there is no mention that :
the port and SID must also be passed in the
ds.setURL(jdbcUrl) found in the authenticateUser() method, or an exception is thrown. This differs from value of the jdbcUrl string found in the getDBConnection() , which makes it hard to figure out
The tutorial is great even if it doesn't work out of the box, but I am disappointed that errata or completed code for this project is not available, especially when you explicitely point to it via the steps mentioned above.
Thanks,
PatrickThe tutorial seems to be using the old JDeveloper 10.1.2.
If you are aiming to learn JDeveloper then just use the tutorials linked from the JDeveloper home page.
http://www.oracle.com/technology/obe/obe1013jdev/index.htm
Maybe you are looking for
-
Error in MAIN_NEWBAS/STARTSAP_NBAS Upgrade EHP1
Hi We have errors in this downtime phase of our BI upgrade. It looks like the KERNEL hasn't updated correctly ? When I run R3INLPGM the environment variables do not show. The SCS 00 instance started o.k. and Instance 01 is partially up with DISPATCHE
-
Issues with WMV HD Editing & Newbie Questions
Hi, I am new to PE7, so apologies if some of these have been asked b4, I searched but couldn't come up with direct solutions. I mainly edit HD WMVs, raw HD videos and MPEGs, to be used on PCs and on the internet. Most used output would be HD 1280x720
-
Replicate some tables from local database server to Remote database sever
how can i replicate some tables from local database server(Oracle 8.1.7 on windows 2000 server) to a remote database server(Oracle 8.1.7 on Sun Solaris) whenever there is some insertion or updation on the table of base(main) database it should get up
-
Actionscript + SQlite error.... help! (flex builder)
Ok, I have narrowed down my error to have been coming in some way from the following code: [CODE] for (var i:int = 0; i < size; i++) try createStmt = new SQLStatement(); createStmt.sqlConnection = conn; var sqlInsert:String =
-
Get Java Version from Applet to JSP
Hi Forum! I am trying to collect client information with a jsp page and put the information into a html form. Besides the request information and some javascript screensize and flash version information I'd like to get the client's Java Version and V