You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Maurizio Pedraglio <pe...@ngi.it> on 2006/05/16 10:43:16 UTC

change database server "on the fly"

Hi list,
I want to change db (migration from mysql5 to oracle 9i) without 
reinstalling jetspeed2.
Anybody know if is it possible to change only few configuration files 
under my application server (where J2 has been installed)?

Thanks,
Maurizio


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: change database server "on the fly"

Posted by Maurizio Pedraglio <pe...@ngi.it>.
Hi Alexey, thank for your reply and your useful help!!

You're right, I'm using multidb distribution (I started directly from 
mysql5).
I tried to follow your steps (download connector, place it in share 
folder and generate the schema on oracle server)
and now all is working properly.

Thanks a lot!
regards,
Maurizio


Alexey Manulenko wrote:
> Hello,
>
> It seems that you are using J2 MultiDB distribution (correct me if I'm
> wrong).
> I've been using J2 Derby Embedded Driver (the two doesn't seem to differ
> THAT much :-)) distribution and I wanted to migrate to MySQL without
> downloading another 70+ Mb and reinstalling everything from scratch.
>
> So, I performed the following steps, hope it helps in your case (as I 
> have
> said the two J2
> distributions doesn't seem to differ that much).
>
> 1. Download appropriate database connector.
> First perhaps you'll need to get (download) appropriate database 
> connector.
> I needed mysql-connector-java-3.1.12 for mySQL, you'll probably need 
> one for
> oracle.
> The list of available database connectors with download links could be 
> found
> here:
> http://www.dbvis.com/products/dbvis/drivers.html
>
> Besides, there you can find DBVisualizes the best database visualization
> tool in the world imho
> (although it's TOO slow sometimes :-)).
> You may want to download this nice utility too. :-)
>
> 2. Install connector and copy necessary .jar file(s) to appropriate
> directory.
> In my case I extracted mysql-connector-java-3.1.12.tar.tgz contents to
> C:\mysql-connector-java-3.1.12
> and copied mysql-connector-java-3.1.12-bin.jar file to (in my case)
> C:\Apache Jetspeed 2.0\shared\lib
> You may need to do something like this with oracle connectors.
>
> 3. Create J2 database.
> In my case I created database named "j2" using WinMySQLadmin.
> You may need to create the new database named "j2" with Oracle tools.
>
> 4. Edit jetspeed.xml
> In my case I needed to change:
> From:
> ===========jetspeed.xml.original =================
> <Context path="/jetspeed" docBase="jetspeed" crossContext="true">
>
>  <Realm className="org.apache.catalina.realm.JAASRealm"
>         appName="Jetspeed"
>         
> userClassNames="org.apache.jetspeed.security.impl.UserPrincipalImpl"
>         
> roleClassNames="org.apache.jetspeed.security.impl.RolePrincipalImpl"
>         useContextClassLoader="false"
>         debug="0"/>
>
>
> <Resource name="jdbc/jetspeed" auth="Container"
>            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>            type="javax.sql.DataSource" username="" password=""
>            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
> url="jdbc:derby:C:\Apache Jetspeed
> 2.0/webapps/jetspeed/WEB-INF/productiondb;create=true"
>            maxActive="100" maxIdle="30" maxWait="10000"/>
> </Context>
> ==========================================
>
> To:
> ===========jetspeed.xml=======================
> <Context path="/jetspeed" docBase="jetspeed" crossContext="true">
>
>  <Realm className="org.apache.catalina.realm.JAASRealm"
>         appName="Jetspeed"
>         
> userClassNames="org.apache.jetspeed.security.impl.UserPrincipalImpl"
>         
> roleClassNames="org.apache.jetspeed.security.impl.RolePrincipalImpl"
>         useContextClassLoader="false"
>         debug="0"/>
>
> <Resource name="jdbc/jetspeed" auth="Container"
>            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>            type="javax.sql.DataSource" username="" password=""
>            driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/j2"
>            maxActive="100" maxIdle="30" maxWait="10000"/>
> </Context>
> ==========================================
> The above assumes that your Jetspeed2 database is named "j2".
>
> Since you are using Oracle database you may need to use another
> driverClassName and database connection string,
> I suppose they would be something like
> driverClassName="com.mysql.jdbc.Driver" and
> url="jdbc:oracle:thin:@localhost:1521:sid" or
> url="jdbc:oracle:oci:@localhost:1521:sid" respectively.
> (never had any deals with Oracle, sorry)
>
> 5. Finally you need to populate your j2 database, i.e. you'll have to
> execute some SQL script files.
> I've been using J2 Derby Embedded Driver distribution.
> I unzipped "jetspeed2.0-derby-install.jar" contents to
> jetspeed2.0-derby-install directory and copied all *.sql files from
> jetspeed2.0-derby-install/database directory and it's subdirectories to
> mysql\bin directory (all files in one directory without keeping
> subdirectory structures).
> You will need the following sql script files and you should execute them
> EXACTLY in the order given  below:
>
> phase1-schema.sql
> phase2-schema.sql
> phase3ojb-schema.sql
> prefs-schema.sql
> registry-schema.sql
> security-schema.sql
> populate-userinfo-for-default-psml.sql
> populate-db-default.sql
>
> Try to find them somewhere in your distribution archive.
> If for some reason you cannot find this files in your distribution, I've
> attached them to my message.
>
> I then executed the above script files the following way:
> C:\mysql\bin\mysql.exe <Enter>
> mysql> \. phase1-schema.sql <Enter>
> mysql> \. phase2-schema.sql <Enter>
> mysql> \. phase3ojb-schema.sql <Enter>
> mysql> \. prefs-schema.sql <Enter>
> mysql> \. registry-schema.sql <Enter>
> mysql> \. security-schema.sql <Enter>
> mysql> \. populate-userinfo-for-default-psml.sql <Enter>
> mysql> \. populate-db-default.sql <Enter>
>
> 6. I then removed  C:\Apache Jetspeed
> 2.0\webapps\jetspeed\WEB-INF\productiondb
> catalog just for sure. :)
>
> 7. Restart your portal.
>
> Hope this helps. :-)
>
> Best reagrds,
> Alex
>
> P.S. I'll try to do something like I've described above with sap db 
> drivers
> and connectors when I have time...
> P.P.S. You can play with php-demo and DBBrowser portlets the same way to
> make them actually WORK.
> :-)


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


Re: change database server "on the fly"

Posted by Alexey Manulenko <ma...@rosten.elektra.ru>.
Hello,

It seems that you are using J2 MultiDB distribution (correct me if I'm
wrong).
I've been using J2 Derby Embedded Driver (the two doesn't seem to differ
THAT much :-)) distribution and I wanted to migrate to MySQL without
downloading another 70+ Mb and reinstalling everything from scratch.

So, I performed the following steps, hope it helps in your case (as I have
said the two J2
distributions doesn't seem to differ that much).

1. Download appropriate database connector.
First perhaps you'll need to get (download) appropriate database connector.
I needed mysql-connector-java-3.1.12 for mySQL, you'll probably need one for
oracle.
The list of available database connectors with download links could be found
here:
http://www.dbvis.com/products/dbvis/drivers.html

Besides, there you can find DBVisualizes the best database visualization
tool in the world imho
(although it's TOO slow sometimes :-)).
You may want to download this nice utility too. :-)

2. Install connector and copy necessary .jar file(s) to appropriate
directory.
In my case I extracted mysql-connector-java-3.1.12.tar.tgz contents to
C:\mysql-connector-java-3.1.12
and copied mysql-connector-java-3.1.12-bin.jar file to (in my case)
C:\Apache Jetspeed 2.0\shared\lib
You may need to do something like this with oracle connectors.

3. Create J2 database.
In my case I created database named "j2" using WinMySQLadmin.
You may need to create the new database named "j2" with Oracle tools.

4. Edit jetspeed.xml
In my case I needed to change:
From:
===========jetspeed.xml.original =================
<Context path="/jetspeed" docBase="jetspeed" crossContext="true">

  <Realm className="org.apache.catalina.realm.JAASRealm"
         appName="Jetspeed"
         userClassNames="org.apache.jetspeed.security.impl.UserPrincipalImpl"
         roleClassNames="org.apache.jetspeed.security.impl.RolePrincipalImpl"
         useContextClassLoader="false"
         debug="0"/>


 <Resource name="jdbc/jetspeed" auth="Container"
            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
            type="javax.sql.DataSource" username="" password=""
            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:C:\Apache Jetspeed
2.0/webapps/jetspeed/WEB-INF/productiondb;create=true"
            maxActive="100" maxIdle="30" maxWait="10000"/>
</Context>
==========================================

To:
===========jetspeed.xml=======================
<Context path="/jetspeed" docBase="jetspeed" crossContext="true">

  <Realm className="org.apache.catalina.realm.JAASRealm"
         appName="Jetspeed"
         userClassNames="org.apache.jetspeed.security.impl.UserPrincipalImpl"
         roleClassNames="org.apache.jetspeed.security.impl.RolePrincipalImpl"
         useContextClassLoader="false"
         debug="0"/>

 <Resource name="jdbc/jetspeed" auth="Container"
            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
            type="javax.sql.DataSource" username="" password=""
            driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/j2"
            maxActive="100" maxIdle="30" maxWait="10000"/>
</Context>
==========================================
The above assumes that your Jetspeed2 database is named "j2".

Since you are using Oracle database you may need to use another
driverClassName and database connection string,
I suppose they would be something like
driverClassName="com.mysql.jdbc.Driver" and
url="jdbc:oracle:thin:@localhost:1521:sid" or
url="jdbc:oracle:oci:@localhost:1521:sid" respectively.
(never had any deals with Oracle, sorry)

5. Finally you need to populate your j2 database, i.e. you'll have to
execute some SQL script files.
I've been using J2 Derby Embedded Driver distribution.
I unzipped "jetspeed2.0-derby-install.jar" contents to
jetspeed2.0-derby-install directory and copied all *.sql files from
jetspeed2.0-derby-install/database directory and it's subdirectories to
mysql\bin directory (all files in one directory without keeping
subdirectory structures).
You will need the following sql script files and you should execute them
EXACTLY in the order given  below:

phase1-schema.sql
phase2-schema.sql
phase3ojb-schema.sql
prefs-schema.sql
registry-schema.sql
security-schema.sql
populate-userinfo-for-default-psml.sql
populate-db-default.sql

Try to find them somewhere in your distribution archive.
If for some reason you cannot find this files in your distribution, I've
attached them to my message.

I then executed the above script files the following way:
C:\mysql\bin\mysql.exe <Enter>
mysql> \. phase1-schema.sql <Enter>
mysql> \. phase2-schema.sql <Enter>
mysql> \. phase3ojb-schema.sql <Enter>
mysql> \. prefs-schema.sql <Enter>
mysql> \. registry-schema.sql <Enter>
mysql> \. security-schema.sql <Enter>
mysql> \. populate-userinfo-for-default-psml.sql <Enter>
mysql> \. populate-db-default.sql <Enter>

6. I then removed  C:\Apache Jetspeed
2.0\webapps\jetspeed\WEB-INF\productiondb
catalog just for sure. :)

7. Restart your portal.

Hope this helps. :-)

Best reagrds,
Alex

P.S. I'll try to do something like I've described above with sap db drivers
and connectors when I have time...
P.P.S. You can play with php-demo and DBBrowser portlets the same way to
make them actually WORK.
:-)

----- Original Message ----- 
From: "Maurizio Pedraglio" <pe...@ngi.it>
To: "Jetspeed Users List" <je...@portals.apache.org>
Sent: Tuesday, May 16, 2006 12:43 PM
Subject: change database server "on the fly"


> Hi list,
> I want to change db (migration from mysql5 to oracle 9i) without
> reinstalling jetspeed2.
> Anybody know if is it possible to change only few configuration files
> under my application server (where J2 has been installed)?
>
> Thanks,
> Maurizio
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
>
>