Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Chris Staten

Ranch Hand
+ Follow
since Sep 24, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Staten

I'm having a problem getting a datasource from WebSphere when using Hibernate. Here are my datasource connection settings in my hibernate.cfg.xml file (stack trace at bottom of post)



My environment is:

WebSphere 6.1
Hibernate 3.2.4 sp1
Hibernate annotations 3.3.0 ga
Java 5


Exception:
I'm back!

It seems that there were some other lurking issues that I didn't think about when setting up my Java Stored Procedures this way. Of course I found out about these issues in production rather than testing.

The problem that I ran into is

I'd love some feed back if anyone sees a problem with this change.

Thanks!

EDIT: It looks as if bold text doesn't work well inside the code block text. The changes start after the

rs = stmt.executeQuery();

line.
[ August 02, 2006: Message edited by: Chris Staten ]
I work for a state agency that works with a regulated community that must submit monthly, semi-annual, and annual reports. I have a J2EE program that allows for the reports to be submitted on line and my boss wants to do some kind of outreach to encourage more use of it. I was thinking about setting up an email ListServe but I wasn�t sure how hard it would be to create.

I�ve been looking on line a bit for information and I saw the following links from this thread here at JavaRanch.

Sending email using SMTP and Java
http://www.mckoi.com/database/

Of course I�ve also been to Sun�s JavaMail API page as well.

I guess what I�m looking for in this thread is any information from someone who may have already created a ListServe about how hard it was to create the program.

Thanks!
14 years ago
Yeah, I went there to check it out and saw that it's a pay site. I don't have a problem with paying a few bucks if I really need the service. Although, right now I'm doing OK with un-jaring files and hunting for the class/package I need.

As for using google, well, I do that and all I can seem to come up with is the javadoc for the classes I need. As far as I can tell that still doesn't give me the .jar file that they can be found in.

Thanks for the suggestions though!
14 years ago
If I know what class or package I need for a program, how do I find out what jar file that class is in? I'm not so worried about the classes from Sun, but what about other vendors like Oracle?
14 years ago
Hey all, I�m about to try and figure something out with some code that I�m working on. However, before I get started I wanted to ask a question, just to make sure that I�m not on a wild goose chase.

Is it possible to use JDBC to make a remote call from inside a Java Stored Procedure in one Oracle database (on its own database server) to a procedure/function in another Oracle database on a completely different database server?

Right now I�m attempting to use a DB link to call a Java Stored Procedure on Database_B from a PL/SQL procedure on Database_A. This is causing an error. I want to try to make the PL/SQL procedure on Database_A call a Java Stored Procedure in the same schema on Database_A. Then that Java Stored Procedure will use JDBC to call a function on Database_B. That function will call a Java Stored Procedure in its schema.
OK, I've all but finished this build file! Here's what it looks like now:


A few things to note.

1. I may have a few more things in the build file than I need, this is because after I learned how to do them I wanted to find a way to use them
2. I may be doing the same type of thing two different ways, this is for the same reason as above.
3. I could not get Oracle's dropjava utility to work with ANT (you can see it commented out in the code above) so I created a batch file and I just call it from my build file. I don't like this implementation, but it's working for now.
4. I can't get the tstamp task to work right, I've read the manual and I just can't make it work. All I ever get is "org.apache.tools.ant.taskdefs.Tstamp@148aa23" as my time. If anyone has any idea what I'm doing wrong please let me know .


All in all I'm happy with my first time playing with ANT, these were my first steps into the world of build tools and it's amazing how much time they can save.
[ August 16, 2005: Message edited by: Chris Staten ]
14 years ago
OK, I've got everything working just fine by jaring up the .java files and not the .class files. They get compiled and loaded into the DB just fine when I move the jar file over.

I'd still like to figure out why I can't directly put my class files over though.
14 years ago
Hey all, I have a quick question about java and Oracle 9i. I�m using Oracle�s loadjava utility to load java classes into my database and then calling them using PL/SQL. I read where the loadjava utility works with .java, .class, and .jar files, so I decided to compile all of my code and jar it up before moving it over to the database (seems cleaner to me).

This is where I run into a problem, all of my classes seem to have errors in them when I do this, but if I take the .java files and move them over using the loadjava utility then they compile just fine and all is good.

Any idea why my code only works when the source code is moved over?
14 years ago
I think I may have found the right driver for using the SQL tag, I'm looking at using oracle.jdbc.driver.OracleSql.

Here's what my SQL tag will look like:


I'll have all of my PL/SQL wrappers in the sql.txt flat file.


Thanks!
15 years ago
OK, I�m getting a bit excited here with ANT so bear with me please

I�ve changed the way I�m going to build my java files and move them over to the database, here are my new steps:

  • I�m going to compile all of my .java files
  • Jar up the .class files
  • move the .jar file to the database using the loadjava utility
  • move the .jar file to a different directory
  • Then I�m going to use the SQL tag to create all of my PL/SQL wrappers (i.e. functions) in the database


  • I just need to figure out a few things. First thing I�m trying to figure out is which JDBC driver should I be using? In my datasource I link to Oracle�s classes12.jar for my JDBC classes, but I don�t link to a specific package or class. The way I read the SQL tag property for driver is that it requires a specific class. Anyone know how I can figure out just which class I need?

    The other thing I�m looking into is if I will need to change the way my PL/SQL wrapper calls a java stored procedure when it�s in a jar file.
    15 years ago

    I anticipate your next question will be how do I loop in ant?


    Very perceptive!

    Thank you very much for your reply. I'm also thinking about getting a book on ANT. I know that the manuals are at the Apache site, but I think it would be nice to have a few more examples as well. I saw a review on slashdot about Ant: The Definitive Guide from O'Reilly, it seems like a good choice.

    As for the batch file, you're right about me being set on learning ANT.


    I do have a question that I can't seem to find even when searching online (although I may be over complicating this or reading right over the answer). How do you explicitly invoke a target? Do you just call the target from inside another target with an element? This didn't seem to intuitive to me when I followed a tutorial - the one that builds UKlights. It looked like every target was called via a dependency attribute; this works fine if you want the target called before the current target, but what if you want it called during a sequence of actions? I guess that I may be making this difficult for myself for no reason, but the confident feeling that comes with clarity feels so darn good
    15 years ago
    Hey all, I am trying to learn ANT and would love some help if there is any out there. I am trying to do something along the lines of moving every file that I have in a directory over to an Oracle database using the loadjava utility in Oracle. I am guessing that I will have to do this by:
    1. looping through some kind of control statement while reading each .java file name in my directory

    2. using the current value of some variable to specify what .java file I am moving (each loop through)


    Here is what my load java command line argument looks like when I do it manually:


    I�m not looking for a free answer to my problem, maybe just a point in the right direction. I�ve been to the manual at ant.apache.org to read up a bit. After what I�ve read so far I think I may want to use the <arg/> tag, but I don�t know how I�m going to dynamically get all of the file names in a directory or how to do the looping. Here�s where I�m stuck in my buildfile (this could be WAY off from what it should be):


    Any info would be great, Thanks!

    EDIT:

    I just saw the link at the top of the ANT, Maven and Other Build Tools forum page. I'll try looking there really quick.

    [ July 25, 2005: Message edited by: Chris Staten ]
    [ July 25, 2005: Message edited by: Bear Bibeault ]
    15 years ago
    Here is the working PL/SQL wrapper, java stored procedure, and calling Servlet code:

    PL/SQL wrapper:


    NOTE: you need to create a REF CURSOR before you can use the above function.


    Java stored procedure:


    Servlet code (calling fragment):

    [ July 07, 2005: Message edited by: Chris Staten ]