This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Do you understand how JDBC-ODBC bridge for MS access works and have you done any JDBC coding before? I'd start by telling us how far along you are in setting up the Java/Access bridge before focusing on storing objects.
BTW- do you mean files or text when you say objects?
Normally the object you want to store consists of ints, Strings, dates, and other simple things that correspond to columns of the tables in the database. If your design is just to put Java objects into a database table, then almost certainly your design is incomplete.
Originally posted by harmandeep singh saini: First thanks Scott Selikoff for your response.
Yes i know how JDBC-ODBC bridge works in java.
Actually i am making an entity ejb bean(BMP).In this the primary key i am using is a class. But the problem is i don't know how to store this class(i.e Object) in the access database.
I know how to store the other data types like int,double,String etc through java in access database,but i don't know how to store java classes.
Any reason you chose Access? I know developers don't always get to make choices of technologies themselves, but unless someone told you too (and they can justify why) I'd swap to a proper database. Entity Beans are an "enterprise" technology, Access and the JDBC-ODBC bridge most definately are not.
Also, why are you doing anything with an Entity Bean? Unless it is out of some perverse curiousity, or again unless someone has mandated it, I wouldn't bother. Entity Beans are flawed (see numerous discussions in the EJB and ORM forums).
Not exactly a helpful response I know - so feel free to tell me that you just have to and I'll shut up. I just hate seeing people waste time struggling with what are bad choices of technology in the first place. [ August 22, 2008: Message edited by: Paul Sturrock ]
I'm going to echo Paul (probably), but Access + EJB? Ewwww.... ODBC-JDBC bridges are hard enough and JDBC code into Access is kind of ugly to begin with but EJB? That's just asking for misery. I'd ether drop the EJB or drop the Access, can't imagine those two working together in a usable product.
Joined: Aug 18, 2008
OK I dropped access database. Now i am using oracle.Now how can i store java class object(i.e primary key)in oracle.
Suppose the primary key class is as under
Can you give me the coding for storing this class object in oracle through java.
That looks to me like just a wrapper for a String. If it was me, I would just store the String in the database column. Especially since it's a primary key column. Oracle just isn't going to apply the class's rules for equality (and neither is any other database), so once you write a record with an instance of that class stuffed into the primary key, you won't have any way of reading that record back by key.
You'll need to fix the class so that it has a method which returns the String variable.