Jacob George

Ranch Hand
+ Follow
since Jun 26, 2001
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jacob George

Hi guys,
My friend is to negotiate an offer with a Singapore based IT company in the coming days. Wondering what could be the decent salary range for an IT guy in Singapore with 5+ years of experience in java. Can someone please help me on this?


Thanks,
Jacob
16 years ago
Hi,
I have installed Oracle 10gAS and has deployed an ear. There are a couple of jars and dlls I need to access/load for the smooth running of my application. Can anybody please advice me on how and where I need to specify these. In orion-application.xml, I found a tag named library; but this is only for library path, right? Where should I specify the class path.
I am really stuck up on this. Please help.

Thanks & regards,
Jacob George
17 years ago
Dear friends,
First of all let me introduce myself as a novice in J2EE; all my 4+ years work experiance was with core java technologies. The new project which is about to begin is in J2EE and I am presently given basic J2EE training. Now I will come to the problem.

We are to offer a set of interfaces to developers so that they can dynamically couple their custom code to our application, provided they implement an adapter module (as per our spec). In the case of J2EE, how can we do that? Is JCA the only answer to adapt third-party (custom) modules into J2EE environment. The EJBs (our business logic), which are already deployed in J2EE server, should be able to communicate with the external modules being plugged in. In what all ways can we do this in J2EE? The ways I have found out is either by using a JDBC plug-in (custom driver) or by implementing a JCA adapter. Are there any other methods?

Best Regards
Hi,
I have an Applet class that requires JRE1.4.2 for execution. In the HTML applet initialization page, I cannot give the URL to Sun's site for plug-in download because they keeps on changing the link to installer while modifying the site layout/content. So, I was think of hosting the JRE installer in my web server and provide that link for plug-in installation (automatic plug-in download). I would like to know whether there will be any licensing problems? Please help me with this.

Thanks & Regards,
Jacob
18 years ago

Originally posted by Gunjan Malhotra:
Hi,
I seem to have forgot thread basics
In following program i have created 2 threads.
class extending Thread Class has two sunchronized methods ehere in one code in sec synchronized method ie callme2() calls callme1(). As per the output, it is possible..
Also,If a thread sleeps in a synchronized methos, other thread can enter into the same method. As per my knowledge so far it shuld not happen, but it is actually happening..
i think its time to open my books again


class threadtest
{static void print(String message)
{System.out.println(">>>>>> "+message);}
public static void main(String[] args)
{new SimpleThread("A").start();
new SimpleThread("B").start();
}
}
// **************************************************
class SimpleThread extends Thread
{public SimpleThread(String str)
{super(str); }
public void run()
{callme1();
callme2();
}
void callme1()
{threadtest.print("111");
synchronized(this)
{threadtest.print("in Callme1 "+getName());
try { sleep(5000);
} catch (InterruptedException e) {}
threadtest.print(getName()+" getting out of Callme1");
}
}
synchronized void callme2()
{threadtest.print("in Callme2 "+getName());
callme1();
threadtest.print(getName()+" getting out of Callme2");
}
}

/* Output
>>>>>> in Callme1 A
>>>>>> in Callme1 B
>>>>>> A getting out of Callme1
>>>>>> in Callme2 A
>>>>>> in Callme1 A
>>>>>> B getting out of Callme1
>>>>>> in Callme2 B
>>>>>> in Callme1 B
>>>>>> A getting out of Callme1
>>>>>> A getting out of Callme2
>>>>>> B getting out of Callme1
>>>>>> B getting out of Callme2
*/



Hi,
In the code you have given, 2 seprate Thread instances are being created; hence they are two different objects and object synchronization doesn't really matters. You should have created one runnable object and two threads to execute them. In the later case, the object will be locked and the threads will queue while executed. Btw. While calling Thread.sleep(), none of the acquired/locked resources will be released. Infact, this is one of the differences between calling sleep and wait.
regards

Originally posted by suresh rg:
Hi
Suppose a query fetches some 20000 records from DB & the client displays the results just 10 records per page, How big is the resultset. In ASP we have a provision for fetching the results page by page to reduce the overhead on the server. Do we have anything in JDBC to send results page/page


Hi,
The Statement class contains a method named setFetchSize(int) to specify how much rows should be fetched from server at a time. Issuing such a command won't force the driver to comply; its up to the driver implementation. From what I have observed (SQL Server drivers), if the Statement is created as ResultSet.TYPE_SCROLL_SENSITIVE or TYPE_SCROLL_INSENSITIVE (ie. if Statement makes use of cursors), the hint provided my user on fetchSize is accepted by the driver; otherwise the parameter is just ignored.
regards Jacob

Originally posted by Jaggi Kunal:
I have JDK1.4. But when I try to print the API using javap javax.sql.Connection I don’t get the output. What do we need to install for JDBC2.0?


!!!
Hi,
I am from Cochin, Kerala.
cheers Jacob
19 years ago

Originally posted by Vishal Saxena:
hello,
Without it too, the driver/db info. can be read from a file - it need not be hard coded in the class.
With it too - the DataSource properties will be read from a file to bind it, the jndi info will again be read from a file for lookup.
regards,


Hi,
In a distributed environment, the datasource is created by a privilaged user (an admin) and all the clients look-up these datasource objects from a repository. So even-if the physical location of database server changes, only the datasource bound by admin needs modification; all the clients performing a look-up operation on this modified datasource will be working on this new information. So the client needn't be bothered of any changes on the URL, authentication details.
If the clients were using a normal Connection object, all the clients need to be updated on the changed information of DB server.
regards Jacob

Originally posted by Huzefa Zohaib:
Can I write the object to Database
I want to write the object in database can I do it by converting it to
set of bytes or strings or otherwise.


Hi,
You may do so using setObject() method in PreparedStatement, provided u'r object has an equivalent SQL Type mapping(Please refer the java doc for more details). Otherwise, you have to convert your object into byte[] and then set the same using setBytes() method. In the code snippet given below, I have assumed that the object to be stored in database implements serializable/externalizable interface.

This will insert the object into database. While retrieving the object, you have to do the reverse procedure; take the byte[]; then create a ByteArrayInputStream; ObjectInputStream on top of ByteArrayInputStream and then call readObject().
regards Jacob
Hi,
You don't have to put the single quotes around ? in a PreparedStatement. The driver puts the quotes for you if a String value is being set. So please use query of the form,
pstmt= conn.prepareStatement("INSERT INTO table1 values(?,?)");
pstmt.setInt(1,100);
pstmt.setString(2,"Test");
regards Jacob

Originally posted by Manoj Bajpai:
we all know that preparedstatements improve performance due to precompiled sql statement.
eg
con = getConnection();
ps = con.prepareStatement("INSERT INTO...
...) VALUES(?,?,?,?,?)");
however, if a new instance of con is used each time, is there really an advantage. which means to
truly get the benefit i should make sure i am using the same connection, correct ???
thanks,


Hi,
I would like to stress that, most of the type 4 drivers presently available in market does not make use of pre-compiled temporary procedures.(Most of my experiance was on MS SQL Server drivers)
The main reason is that creation of temporary stored procedures (thats how precompilation is done) doesn't cause much performance enhancements in real-world scenarios and applications. Only the initial query in PreparedStatement (select, insert, update) is pre-compiled; mostly the bulk will be the information passes to the PreparedStatement using its setXXX() methods, which the driver has to send each time to the database server. So as far as the n/w latency goes, there is little performance gain compared to usage of normal Statement.
The only advantage might be on the time taken by server to execute the query. But unlike stored procedures, PreparedStatements usually consists of only a single line query like Select, Update or Insert; So, here also we are not seeing much boost in application performance (since PreparedStatement queries are usually simple ones).
Also, the JDBC spec doesn't enforce that pre-compilation be used for PreparedStatement. From my experiance its noted that there isn't any performance difference between using PreparedStatement with/without precompilation(driver dependent). (Note: Batch operations has some nice performance advantages)
So, as an answer to u'r question, I think you won't be feeling any performance hike/de-gradation even if you are using same/different connection(may be that your driver is not even using pre-compilation).
cheers Jacob
Hi,
Try this code snippet instead; this will work (atleast it works in my machine)

The changes I made are,
1) Usage of ResultSet.TYPE_SCROLL_SENSITIVE+1 instead. Please don't ask me why I did it. I have heard that some drivers got this problem(not sure whether its a problem. This should be in their docs)
2) You have to scroll/position the ResultSet before updating the data.
I have noticed that for the new Sprinta2000 driver, "select" won't work inside executeUpdate(). May be you have an older version.
regards Jacob
Hi,
In u'r code snippet, please replace

with

Now, please check whether the row is being updated as required.
Hi,
I am a newbee in this XML arena. From some documents, I read that XML instance documents are converted to XML Information Sets and then to PSVI. This is inturn converted to XML Data Model, on which XPath and XQuery operates. Is the XML Information Set validated against XML Schema so as to generate PSVI? Is structure of PSVI same as that of XML information Set? Please help me.
regards Jacob