File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes help in creating DAL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "help in creating DAL" Watch "help in creating DAL" New topic
Author

help in creating DAL

Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hi all,
i want to create a DAL for my application can any body guide me how to proceed in creating it. Any help would be apprieciated


[Vipassana] - It is seeing the reality as it is, And not as you want it to be.!!!
SCJP1.5.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
138

Take a look at the data access object pattern.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hii Jeanne,
thank you for your reply i have gone through the j2ee patters link. its good but its not what i wanted. i want to prepare a reusable class from which i can add parameters into it and call the stored procedure. to execute it. i have seen this feature in one of my collegues DAL(in .net) and i wanted to create it in java. where they add parameters to say a hashtable and call pass the direction of the parameter and finally execute the stored procedure. so how do i proceed it in java.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
138

In Java, DAL stands for data access layer.

I suppose you could write a method that takes in an ArrayList (HashTable is unordered) of parameters and String SQL statement. Then using reflection, you could call the appropriate stmt.set method - date, string, int, etc.
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hi jeanne,
sorry for replying late was busy in some other tasks. for DAL i want to create a generic DAL which can be used with any database. how to proceed with it like i am thinking about this kinda method



but when i try to create DBUtilDBType enum it



it gives me an error i have already added the ojdbc6.jar to the lib directory.

how do i proceed kindly help..........
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
138

I don't see where you state what the error is.
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

Here in this code


OracleTypes is an Abstract class and it does not allow me to do this



even if i put a semicolon after the OracleTypes.BOOLEAN it gives the error.
kindly help.
Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 166
Hi
See what OracleTypes.BOOLEAN returns. You should be able to understand.
Jhakda


If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hi velu,
OracleTypes is an Abstract class and im not able to get its attributes listed in intellisense.
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help in creating DAL
 
Similar Threads
For the food lovers of the world..
Using Entity Bean with Data Access Layer
passed with 93%
how to create jar file in WSAD?
WA #1.....word association