The Artima Developer Community
Sponsored Link

Java Answers Forum
hi group !! Share your views on this........

3 replies on 1 page. Most recent reply: Jan 27, 2004 4:32 PM by Sachin Joshi

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Sachin Joshi

Posts: 12
Nickname: aspire
Registered: Jan, 2004

hi group !! Share your views on this........ Posted: Jan 25, 2004 11:48 PM
Reply to this message Reply
Advertisement
As this forum is dedicated for Java Design related issues, I would like to start a small discussion about a system.
My intention is to share my views and get the opinions from the group from their experiences.

I was just thinking of a simle system that will connect to different databases (Oracle, As/400) and execute some query.
After the query execution, there will be a report generating facility.
Now, this may be developed in swing or might be in JSP, but what matters most is the base class structure. I guess, that
will remain same for any type of front end you develop.

I have started with some idea and putting it below. I would like to have group's views/suggestions on it
(positive/ negative both ).

Here it goes:

Requirements of the system:
1. There should be some file in the system that would store data about different database profiles. Here profile means,
data required to connect to a database. e.g. To connect to oracle you need : DbDriver Name, Machine Ip, Port number, Db
Instance Name, User Name, Password.
So, I have thought of a XML file to store this info. Structure of the XML file would be -->
<DbProfiles>
<Profile id=”1” DbType="Oracle">
<ServerName>sgp</ ServerName>
<ServerIP>xx.xx.xx.xx</ServerIP>
<port>1234</port>
<DbInstanceName>seca</DbInstanceName>
<UserName>name</UserName>
<Password>pass< /Password>
</Profile>

<Profile id=”2” DbType="SqlServer">
<ServerName>sgp</ ServerName>
<ServerIP>xx.xx.xx.xx</ServerIP>
<port>1234</port>
<DbInstanceName>seca</DbInstanceName>
<UserName>name</UserName>
<Password>pass< /Password>
</Profile>
...so ON
</DbProfiles>

2. There will a base interface like:
interface DbProfile{
String dbUserName;
String password;
String driverName;
String machineIP;
String machinePort;
String dbInstance ;

String getURL();
String getUserName();
String getPassword();
}

3. There will be classes implenting this interface. There could be 1 class for 1 Db type. i.e. Currently I have thought of like
public class OraProfile implements DbProfile {}
public class As400Profile implements DbProfile {}
..
..
so on.

The XML file defined in the step 1 will be read when the utilty starts and it will create instances of classes equal to the number of
profiles defined in file. All such instances created will be stored at some global place and then will be used for creating
connections.

3. I have thought of 1 more class that will define a method as below:

public class DoDbTask{
public Connection getConnection(DbProfile objDbPRofile){
}

public ResultSet execute(Connection con, String query) {
}
}

Though the complete concept of the system contains reporting facility also, for now only this much I have put on the paper.
I know, it is not too much. But, before going ahead I thought of doing validation by sharing my ideas with the group.

Hope to get your views on this.

Thanks,
Sachin


Sachin Joshi

Posts: 12
Nickname: aspire
Registered: Jan, 2004

Re: hi group !! Share your views on this........ Posted: Jan 26, 2004 12:21 AM
Reply to this message Reply
Hi all,

Here is a small change from myself only. All the String fields in the "interface DbProfile" are now in "abstract class DbProfileImpl".
And the class OraProfile, As400Profile will extend from DbProfileImpl class. This will force the subclasses
1. to give implementation to getURL() method
and
2. To use the inhertited fields in the superclass

Here is the abstarct class:
public abstract class DbProfileImple implements DbProfile {
String dbMachineName;
String dbMachineIp;
String dbMachinePort;
String dbInstanceName;

String strUserName;
String strPassword;

public abstract String getURL();

public String getUserName() {
return strUserName;
}

public String getPassword() {
return strPassword;
}
} // End of class


hope to receive your feedback on this.

Sachin

mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: hi group !! Share your views on this........ Posted: Jan 27, 2004 5:06 AM
Reply to this message Reply
Just for info sake.

can you check how connection info is maintained in Jdev.

All the the connection infos is saved in an xml file. (with a logic to crypt the password)

User can use the classes provdied by jDeveloper to access database.

And the JSPs can have access to database with the ADF framework provided with the jdevelper.

Sachin Joshi

Posts: 12
Nickname: aspire
Registered: Jan, 2004

Re: hi group !! Share your views on this........ Posted: Jan 27, 2004 4:32 PM
Reply to this message Reply
Hi,

Will surely check in Jdev. Are you talking about Oracle's Java IDE JDeveloper ?

Moreover, do you feel any suggestions in the ideas I put ?

Thanks,
Sachin

Flat View: This topic has 3 replies on 1 page
Topic: How to write resize options in java applet Previous Topic   Next Topic Topic: Make a link between C programming and Java Application

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use