aspose file tools*
The moose likes JForum and the fly likes I've done RC5 for Oracle! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "I Watch "I New topic
Author

I've done RC5 for Oracle!

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Do anybody interested to see that in here?

I can update things for 2.0 and send to Rafael.

These are changes:

0. Support ORACLE 8.1.7 and higher

1. Due Oracle not handle distinguish between NULL and '' (empty string), I've add to entites to appropriate place:
<code>
public String getTitle()
{
return this.title == null ? "" : this.title
}
</code>

At the moment, I modify main classes, but it no problem to inherite specific Oracle *Model and put this there.

2. TEXT field changed to VARCHAR2(4000), which is 4000 chars maximum

3. Moving to ORACLE sequencies

4. Moving to Oracle DATE functions

5. Using ORACLE "rownum" instead of LIMIT/OFFSET
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi Dimitry,

I'll include your Oracle support in jforum for sure . Just some points:

:arrow: Yes, please use *Model to achieve the results. You don't need to implements all interfaces / methods, if some of the "generic" implementation solves the problem. Something like the code done for postgresql / hsqldb.

:arrow: varchar(4000) is not enough. We should not have this limitation, since post messages can be very large. The best would be to use CLOB fields instead.

:arrow: The DATE fields are ok, since 2.0 we're using that for dates

:arrow: In the other post, you say something about the sequences.. the INSERT statement should use the sequences as we do every day - eg, INSERT INTO table ( id, other_fields ) VALUES ( sequence_name.nextval, other_values )

:arrow: If possible, please check if is possible to store cirilyc chars into CLOB fields. Someone told me that for that NCLOB should be used, but I'm not sure.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, thats good.

I will try CLOB/NLOB today.

And also, realize of 2.0 was very surprised )) I come and saw - rc5 disappear. Disaster


[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, I'm trying move things like:



to special subclass entities, let say net.jforum....oracle.entites

I'm tring that:

1. Move all object creation to factory methods (This task is actually large)

And override these to methods in net.jforum.drivers.oracle.ConfigModel
and create my own ConfigFactory to return net.jforum.drivers.oracle.entities.Config

The problems are:

Theare so many places where this entites created: (for Forum):

ForumRepository
ForumRSS
ForumAction

They also should get Factory somehow...


Should we really want to move this way, or just modify base classes for that null/empty string oracle prblems?


[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I commited Topic.java with the modifications to the CVS. No need for workarounds . Just do an update from the repository.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael,

Almost all entities need this.

Just find out all fields like:



They all should be


[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
OK, so let me understand: you say Oracle does not distinguish nulls and empty strings.. Where this will be a problem for you? writing to the database? If so, the best to do would be to check for nulls in your oracle specific ( driver ) code. But ( I never worked with oracle and java ), where is the "main" problem?

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424

OK, so let me understand: you say Oracle does not distinguish nulls and empty strings.. Where this will be a problem for you? writing to the database? If so, the best to do would be to check for nulls in your oracle specific ( driver ) code. But ( I never worked with oracle and java ), where is the "main" problem?
Rafael


Ok, you mean for all list of fields that can be '', I should override persist code to make something from like :



to:


[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
To be hournest, the solution above is very bad. It just add crap to a nice code now. Why just not iterate in java code and make sure that Fields that now DEFAULT '' NOT NULL changed to:

1. They really can be null, so be it. so make them DEFAULT NULL

2. The can't be null, so validate in code, that they are no empty
so, NOT NULL.

Everybody happy
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
(that was me)
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
You can change your oracle schema to allow NULLs ( or even discarding the not null ). Most of the time all necessary fields will have values set ( I say "most" because I'm not sure if this is completely true now ), so the database will have the correct data.
I need to check a lot of code to have this in "the right way".

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Good thing, you say it "the right way" ))) not just "do it yourself, motherf...er"
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, hi

I've done BLOB in oracle for Posts and Private messages.

Is that really nessesary add this stuff to jforum_vote_desc.vote_text and jforum_users. user_sig?

Seems like signature should be reasonably small and vote text too. What do you think?
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael Steil wrote:

:arrow: If possible, please check if is possible to store cirilyc chars into CLOB fields. Someone told me that for that NCLOB should be used, but I'm not sure.



Work absolutely all languages, because I store in BLOB UTF16
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Dmitiry wrote:
Rafael Steil wrote:

:arrow: If possible, please check if is possible to store cirilyc chars into CLOB fields. Someone told me that for that NCLOB should be used, but I'm not sure.



Work absolutely all languages, because I store in BLOB UTF16


Niiiiiiiiiiice

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael Steil wrote:

:arrow: If possible, please check if is possible to store cirilyc chars into CLOB fields. Someone told me that for that NCLOB should be used, but I'm not sure.



Work absolutely all languages, because I store in BLOB UTF16
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
What about things what I think not needed?

It not really hard to add. But is it really needed?
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Dmitiry wrote:What about things what I think not needed?

It not really hard to add. But is it really needed?


What?

Sorry, I didn't understand your question.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Common man, should I winkled every word from you? What about jforum_vote_desc.vote_text ?
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Anonymous wrote:Common man, should I winkled every word from you? What about jforum_vote_desc.vote_text ?


Blob

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael Steil wrote:
Blob

Rafael


Bingo. I change oracle_db_struct.sql to BLOB for that field. Seems this table not used in JForum now ))) So implementing this staff in future drop down on other developer shoulders.
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
But there are additional issues about Oracle:

Seems like it cant work with autocommit connections with sequences. Which is a well knows bug, that if you do on sequence xxx.nextval, you should call xxx.currval from the same transaction.

I've done the following for that:




[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I See.. the commit / rollback control should be done at JForum.java and not Command.java .. I'll put some code to handle this there.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
The code above is in net.jforum.Comand.process()

And add to PooledConnection setting autocommit to false.



And change accordingly every call that look for connection.

I feel myself boring that JForum suddenly require commiting tranactions. What do you think about?
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Ok, I see, that you will put it in JForum. Seems like you ready to recieve my code . I have no access to CVS at the moment, because my ADSL broken for 2 weeks allready :twisted: Can you recieve it by mail or something like?
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Anonymous wrote:Ok, I see, that you will put it in JForum. Seems like you ready to recieve my code . I have no access to CVS at the moment, because my ADSL broken for 2 weeks allready :twisted: Can you recieve it by mail or something like?


You can send to my email, please.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Anonymous wrote:
I feel myself boring that JForum suddenly require commiting tranactions. What do you think about?


Well, some dbs does not support transactions, and the first code were using mysql. But I agree, we should have support for transactions.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
ok, there are 4 fields that you expect should be BLOBS
(As I saw on *_db_struct):

jforum_posts_text.post_text
jforum_privmsgs_text.privmsgs_text
jforum_users.user_sig
jforum_vote_desc.vote_text

Do you want to have 2 latest fields (jforum_users.user_sig and jforum_vote_desc.vote_text) BLOB's too?
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
"signatures" can be varchars.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, files sent to you. Call me back if any problems
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, hi

Have you got a chance to look at my code?
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Dmitiry wrote:Rafael, hi

Have you got a chance to look at my code?


I got your mail, but I didn't look to deeply yet. But onde thing I saw: you left the @author tag with my name.. It would be nice if you put your name there .

I'll mail you as far as I validate the code.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, I am absolutely trust you to change your name to mine - 'Dmitriy Kiriy'
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
The post above is mine Traditionally, forget to login.
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi Rafael. Any news?
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Dmitiry wrote:Hi Rafael. Any news?


Nope, not yet. I guess until next weekend I test it.

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi, Refael.

How things going with my changes?
[originally posted on jforum.net by Dmitiry]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Dmitiry wrote:Hi, Refael.

How things going with my changes?


Hi Dmitiry,

sorry for the delay, I was going to send you an email. I didn't checked the code yet. I'm working in various fixes planned for 2.1, and, specially, refactoring the cache control in so many parts, that is hard to get time to install Oracle and try the code.

But I'll do, for sure. I have in mind make the code easier to enable new databases.. eg, currently all databases that use sequences should override some methods, which is duplication of code, since we need this, so far, for HSQLDB, PostgreSQL and Oracle. So, I'll improve this.

I have setup Confluence ( a professional Wiki-like system ) for the JForum website. There we can work on examples, documentation and etc, which will help a lot. The url is http://www.jforum.net/confluence .

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424

But I'll do, for sure. I have in mind make the code easier to enable new databases.. eg, currently all databases that use sequences should override some methods, which is duplication of code, since we need this, so far, for HSQLDB, PostgreSQL and Oracle. So, I'll improve this.


Agree. However ,there are many difference. Oralcle sequence value can't be define as DEFAULT value in CREATE TABLE statement.

Also, when you look on code that fill BLOBS for Oracle, you will be very surprise on that. Call me, if you think it crap. I know, it isn't
[originally posted on jforum.net by Anonymous]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Rafael, hi

Have you look in my code?
[originally posted on jforum.net by Dmitiry]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I've done RC5 for Oracle!
 
Similar Threads
this operator
Store empty sting in db using JPA
Creating classes
SQL Server + PreparedStatement Oddity
Storing Kanji charaters into database