thread « Database « Java Database Q&A





2. Thread safety - where state is in the database    coderanch.com

In my singleton class, multiple clients will get back the same reference to the object. Then in a "unsynchronized" method of the singleton; they will check if a particular record exists in a table. If it doesn't exists; the method will attempt to create it. Can I depend on the database's locking mechanism for updates (which will lock the row for ...

3. Threads and Databases    coderanch.com

Hello everybody, I am really new in the Java world. Recently, a friend told me about this ranch and I love it. I like metamorphic illustrations I have this application to develop, and I am trying not to re-invent-the-wheel here getting the best OO-approach possible. I have some ideas and read a number of books on the subject I am now ...

4. Threads in Database connectivity !    coderanch.com

I want to use Threading concept while i am connecting to any database . As we create child threads , can I create a similar child connections from the main connection(connected to database). The main connection's job is to monitor whether any child connections are open . If no connections are open , it should close itself . All the database ...

5. database connectivity - multithread    coderanch.com

Hi Ann, This is what I think... Looking at your code, I could see that the object School is being created in the local "service" call. Since all the local variables are in the thread stack and are not shared across the threads, as far as the variable is concerned, it is safe. It could happen that muliple requests coming in ...

6. database and threads java    coderanch.com

7. Database access, potential threading problem?    coderanch.com

I have a class that I use to connect to database, select, insert, delete and modify records, basic stuff. Here is part of code: public class DBDriver { private static String conName = ""; private String sql = ""; // close connection to database private static void closeConnection(Connection conn, Statement st, ResultSet rs){ try{ if (conn != null ) conn.close(); } ...

8. Threads and DB Access    coderanch.com

Hi, I need to write a program that will process records in a batch basically it look for any records being added in a Database table e.g. Requests. If there are any records picks them up and calls a Web Service gets a response and inserts in some other table e.g Response, updates the column in Requests table so next time ...

9. Thread for periodic database updation    coderanch.com

Hi, I want make a thread that once started would periodically keep updating the database (after a specifed interval). I have the database logic in place. My code is something like this: t.start(); while(true) { System.out.println("Inside while(true) Loop"); if(t.isAlive() == true) { System.out.println("Inside t.isAlive() == true"); } try { synchronized(t) { t.wait(3000); } } catch (InterruptedException e){ System.out.println("Thread interrupted" ...





10. Do Threads Block on Database Resources?    coderanch.com

Hi all, Suppose a thread opened a connection to a database and acquired an exclusive lock on a table to delete some rows. What happens when a second thread tries to select a row from that locked table(or to update a row of the table) before the first one releases the lock by a commit or rollback? Does it wait for ...

11. how to maintain database using Threads    coderanch.com

12. Control DB perfomance separately for two application threads    coderanch.com

Hi, I run a Web application that constantly imports data to my DB. This import thread brings lots of reads and writes to my DB. The same Web application sends user requests (user search queries from a website) to the DB. Problem: user requests get slower due to reads and writes to the DB by the import thread. I wonder if ...

13. Threads and database approach question    coderanch.com

Wondering if this approach is safe and workable with Threads and hibernate? One thread is responsible for writing data to the database every few seconds to a minute. I have other threads that start about every five minutes to read the database for the last record entered and do with the data what they will -- they do not update the ...

15. Database issue in Multi threaded application    coderanch.com

Hi All, We are developing a core java multithreaed application which will run across multiple machines(JVM's). Now there is a piece of code which will work like - 1. check if entry is resent in record_master table. 2. If no then make entry in record_master and record_child. 3. If yes then fetch primary key of record_master and use it as foreign ...

16. background thread monitoring database    coderanch.com

Iv tried to create a simple thread that checks the database every 5 seconds but im getting errors on the sleep function, it doesnt recognise it..Im just trying to make sure that this approach is good and possible. here is my code so far: public class AlertRunner implements Runnable{ private JFrame alert; public static int mark = 0; public static int ...





17. Structuring a Multi-Threaded Application: Parse from .csv and write to a database    coderanch.com

I'm up for a job and there's a pre-interview assignment that's got me a bit confused. I've never done anything multi-threaded before, but I got to wow my interviewer with this assignment. The assignment: "Write a Java program that reads a csv file, parses the data, distributes the data to multiple threads, where each line of data in the file is ...

18. Beginners Database thread    java-forums.org

I am trying to include an (Sql) database in a program of mine. I was thinking to use Apache Derby (because it is free and can be embedded) and now have the following (very basic Questions) It is all for a single user database. that (for the moment) the program makes, fills, works with and at the end removes. Maybe later ...

19. Invoke database procedure inside Thread using Java programm    forums.oracle.com

For this i written a java program which implements Thread , inside that i need to fetch the data and from that data i need to check which record is running by using some flag, and then to display on the screen. Again i am fetching the record from table to repeat the same.