LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2006, 12:20 AM   #1
MRMadhav
Member
 
Registered: Nov 2005
Location: Mauritius
Distribution: PCQLinux, SUSE Linux,Fedora Core 5, Fedora Core 6, Knoppix Live, Kubuntu Edgy, PCLinuxOS
Posts: 167

Rep: Reputation: 30
Question Using Same MySQL Connection for 2 Java Appls


Hi All!
I would like to know if there is a way to share the same MySQL connection of 2 different java Appl that are running at the same time. The mySQl connector i use is mysql-connector-java-3.1.11-bin.jar . The platforms that i use is linux and Windows. The relationship between the two appl is that the first one launches a script that executes the second one. But the problem i am facing currently is that when it launches the second one, it has to open another connection to the mysql database which sometimes take too much time. So if there is a way to tell the second application to use the first apllication's connection then the problem would be resolved!
 
Old 07-31-2006, 12:36 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
HI -

If these were servlets in a web application (instead of two standalone applications, which is what your description sounds like), the ideal solution would be to use a connection pool. For example:

http://dev.mysql.com/tech-resources/...onnectorj.html

... or ...

http://forum.java.sun.com/thread.jsp...sageID=3421546

Both of these links use Tomcat (i.e. use servlets), so I'm not sure to what extent that would help you.

'Hope that helps .. PSM
 
Old 07-31-2006, 01:16 AM   #3
MRMadhav
Member
 
Registered: Nov 2005
Location: Mauritius
Distribution: PCQLinux, SUSE Linux,Fedora Core 5, Fedora Core 6, Knoppix Live, Kubuntu Edgy, PCLinuxOS
Posts: 167

Original Poster
Rep: Reputation: 30
Thanks, I'll check the links but as you already figured out, these are 2 standalone applications.
 
Old 07-31-2006, 04:35 AM   #4
MRMadhav
Member
 
Registered: Nov 2005
Location: Mauritius
Distribution: PCQLinux, SUSE Linux,Fedora Core 5, Fedora Core 6, Knoppix Live, Kubuntu Edgy, PCLinuxOS
Posts: 167

Original Poster
Rep: Reputation: 30
Hi, I looked at the Examples given on those links but it won't help me right now as my applications are actually 2 completely different ones. Can we actually do what i am asking? I can't find any reference to this anywhere!
 
Old 09-11-2007, 07:42 PM   #5
aktar
LQ Newbie
 
Registered: Jun 2007
Posts: 13

Rep: Reputation: 0
Persistant connection

I dont know if persistant connection will work.
If it does then its a simple matter of sending the connection ID to the second application
 
  


Reply

Tags
connection, mysql, sharing



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
java + connection to mysql linux_ub Programming 5 03-04-2012 10:59 AM
Mysql and mysql java connector, connection refused arubin Slackware 3 03-29-2008 01:41 AM
java.lang.InstantiationException: java.sql.Connection poeta_boy Programming 2 07-06-2005 08:26 PM
[ JSP/JAVA ] MySQL connection fails White R4bbit Programming 4 04-27-2005 08:31 AM
MySQL/Java connection problem hudy Programming 3 06-23-2004 08:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration