LinuxQuestions.org
Review your favorite Linux distribution.
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 08-28-2008, 08:05 AM   #1
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Rep: Reputation: 30
Java database connection on the fly.....


Hello all,

I am trying to write a class that will allow me to connect to various different databases as long as I pass in the class, url, username and password in java i.e:


Code:
MyClass c = new MyClass().
c.driver="<path_to_driver>";
c.url="jdbc:mysql:/localhost/database";
c.username="user"
c.password="private"


vector = c.sql( "select column1, column2 from database;" );

I'm sure with a bit of effort this is possible, but are there any examples? has this been done before so i dont have to worry about it????

I believe that sqldeveloper( written by oracle ) does something similar with the databases however I could not locate the code for the connections.

thanks, trscookie.
 
Old 08-29-2008, 07:50 PM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Do you mean simultaneous connections? Have you considered using a combination of interfaces and factories? Or generics?
 
  


Reply



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
LXer: Making an open source object database fly LXer Syndicated Linux News 0 11-25-2006 01:33 PM
Database connection using C/C++ shydra Programming 7 02-16-2006 12:51 AM
Snort database: Closing connection to database "" Homer Glemkin Linux - Security 2 07-14-2005 06:58 PM
java.lang.InstantiationException: java.sql.Connection poeta_boy Programming 2 07-06-2005 08:26 PM
java prog with database keikun_naruchan Programming 1 06-29-2004 04:15 PM

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

All times are GMT -5. The time now is 07:45 PM.

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