KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > piratepete > dbpirate > commands > NewConnection


1 package com.piratepete.dbpirate.commands;
2
3 import EDU.oswego.cs.dl.util.concurrent.*;
4 import com.piratepete.dbpirate.ui.Login;
5 import com.piratepete.dbpirate.ApplicationManager;
6 import com.piratepete.util.db.*;
7
8 /**
9  * NewConnection Class
10  * Copyright (C) 2003 David L. Whitehurst<p>
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.<p>
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.<p>
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.<p>
25  *
26  * <a HREF="http://www.piratepetesoftware.com">piratepetesoftware.com</a><br>
27  * <a HREF="mailto:dlwhitehurst@comcast.net">dlwhitehurst@comcast.net</a>
28  *
29  * @version 1.0a
30  */

31 public class NewConnection extends FJTask {
32     
33     public NewConnection() {
34         // do nothing constructor
35

36     }
37     
38     public void run() {
39         
40         // create login
41
Login login = new Login(null, "Login", true);
42         
43         // get parameters and do connection
44
DBWorker myWorker = ApplicationManager.getDBWorkerFactory().createConnection (
45                 login.getUser(),login.getPassword(),login.getHostname(),login.getSid(),login.getDBType());
46         
47         if (myWorker != null ) {
48             DBQueryTest tester = new DBQueryTest(myWorker.getConnection());
49             
50             System.out.println("Got a good connection");
51             
52         }
53         // pass proper helper as argument and create SQLWindow
54

55     }
56     
57     
58 }
59
Popular Tags