Help coderanch get a
new server
by contributing to the fundraiser

J Rosetto

Greenhorn
+ Follow
since Jun 03, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by J Rosetto

Hi,

Is there a way of using System.getProperty() or System.setProperty() in a webapp in an encapsulated way (i.e. so that the global properties of one webapp don't interfere with those in another?).

Alternatively is there something within the J2EE architecture which would provide me with this functionality?
15 years ago
Hi,

I have two Oracle instances which need to be identical. One is built from an old base schema and a number of patch scripts. The other one is built from a new schema file which should be the same as the fully patched database.

Is there any way to easily compare two databases using something like db-unit? I will need to compare not only columns and data, but also stored procedures etc.
I have a stored procedure which takes in a Clob as one of IN arguments:

e.g.
PROCEDURE clob_processor(p_c_frag IN CLOB)

I can run the following code against an Oracle 10g database with no problems:

Connection connection = DatabaseHandler.getInstance().getConnection();
CallableStatement statement = connection.prepareCall("call TEST.CLOB_PROCESSOR.clob_processor (?)");
statement.setString("my clob string");
statement.execute;

However, when I run this same code on Oracle 8i I get the following error:

Exception in thread "main" java.sql.SQLException: ORA-06553: P LS-306: wrong number or types of arguments in call to 'CLOB_PROCESSOR'

Unfortunately I cannot find any way to create a CLOB object to encapsulate my String. There are a couple of createTemporary() methods which can do this, but unfortunately they don't seem to work, as I am using an Apache DBCP connection wrapper.

Does anyone know any other way of generating clobs, or obtaining the wrapped connection from within a DBCP wrapper?
I am having problems configuring commons-logging in Tomcat. What I am trying to achieve is the following:

1) I want Tomcat to log to its own log files using Simple Logging or util logging, using commons-logging.
2) I want all commmons-logging output from my deployed webapp to be redirected to a seperate logging library (not Simple Logging or util logging).


Is this possible, and if so, how would I go about achieving this?


Thanks
16 years ago
I am looking for some kind of library from which I can provide stubs for SQL calls (for unit testing). Kind of like a dummy JDBC driver (a similar idea to JDBCProxy, but better).

It would work in a similar manner to this:

String connectionString = "jdbc:stub:<stub_definition_file>";
Connection connection = DriverManager.getConnection(connectionString, "username", "password");

The stub connection could then be used to create statements, which when executed return whatever data we define in the <stub_definition_file>.


I have a couple of questions:
1) Are there any (mature) existing libraries which do this already?
2) Is this is a good approach to the problem of testing code that accesses a database? (It means we can run unit tests without the dependency of a test database).
Does anyone know of any libraries suitable for stubbing a database for junit testing?

I found one called jdbcproxy which looks quite interesting, but i could find very little in the way of documentation for it.
16 years ago
I have a document which relies on multiple schemas relating to different namespaces.

Is it possible to validate this XML document using Java?
Can anyone tell me if the SAXParser in JDK 6 is thread-safe or not?

In my application I want to have a single SAXParser (configured to use a predefined set of schemas), and have several threads use it for parsing their XML.
16 years ago
Thanks Santhosh.

Unfortunately I am looking for a solution which will allow me to produce the log entries (using our company's bespoke logging library), rather than delegating the logging responsibility to another library.

I notice that the OraclePreparedStatement has a method called getRevisedSql(). I am guessing this provides what I need. Unfortunately I am using Commons DBCP, which means I only have access to DelegatingPreparedStatements which wrap the OraclePreparedStatements and so I have no access to this method.
Does anyone know of a simple way of logging an Oracle prepared/callable statement? I tried calling toString() but all I receive is the object reference.

I believe the Oracle libraries have some functionality for producing their own logs but I'd rather a simpler solution which allows me to log just what I need.

Thanks
Is there any way of appending to the Class-Path: in the manifest file, after it has been generated, using Maven?

I need to add the path "./" to the Class-Path property of the manifest file, but I also need the libraries it depends on added.
16 years ago
I currently have a jar file which requires a properties file (jndi.properties) on the classpath.

The properties file is in the same directory as the jar file, and the Class-Path: attribute of the manifest file contains the value '.', as well as all the other library dependencies. However, for some reason this file isn't being found on the classpath.

Does anyone have any idea how I can get this file placed on the classpath using the Class-Path attribute?
16 years ago
Note, the reason I want to do it like this, rather than putting it into /resources (which will package it into my jar), is that I want to keep the jndi.properties outside my jar file so that it can be easily edited.
16 years ago
Hi,

I am trying to generate a jar file in Maven2 with a jndi.properties file included the Class-Path manifest attribute. The Class-Path attribute also needs to reference all the dependent jar files (which I am currently doing using <addClasspath>true</addClasspath> , but I can't seem to get both.

Is there a way to do this using Maven?
16 years ago
Is it possible to remove a logger from a logger hierachy in java util logging?
I know its not possible in Log4J, so I'm assuming its the same in java util logging as the architectures look fairly similar.
[ June 19, 2008: Message edited by: J Rosetto ]
16 years ago