Tuesday, May 20, 2014

Using TNS names for Java Application

Here are the steps

  1. Add jvm commandline option '-Doracle.net.tns_admin'. Value of this property should point to the directory containing 'tnsnames.ora' file.  
  2. Change value of jdbc.url property to 'jdbc:oracle:thin:@MYDB' Here MYDB is one of the entries in tnsnames.ora file. That's it

Migrating project from SVN to GitHub

SVN to GitHub Migration

This page explain steps required to migrate a project for SVN to GitHub.

Migrating a project from SVN to GitHub can be quite tricky especially if you want to maintain all the history, branches and tags. This guide assumes that once your project is migrated to GitHub you will be cut off from SVN and further commits on SVN won't be synced with GitHub repo. I found svn2git gem is the most convenient way to do get the job done. You might want to take a look at svn2git gem documentation.

  1. Make sure that you have 'ruby' installed on you machine. If not install it.
  2. Install svn2git gem
    $ gem install svn2git
  3. Create a directory where you want to checkout svn project to and cd into it
    $ mkdir my_svn_project && cd my_svn_project
  4. Checkout SVN project using svn2git

    $ svn2git <svn_project_url>

    Checkout time may vary depending upon number of branches and/or tags project has
  5. Rmove remote references for branches and tags

    $ git for-each-ref refs/remotes/tags | cut -d / -f 4- | grep -v @ | while read tagname; do git tag "$tagname" "tags/$tagname"; git branch -r -d "tags/$tagname"; done

    $ git for-each-ref refs/remotes | cut -d / -f 3- | grep -v @ | while read branchname; do git branch "$branchname" "refs/remotes/$branchname"; git branch -r -d "$branchname"; done
  6. Rmove unwanted branches

    $ for branch in `git branch -a | grep "svn"`; do git branch -D $branch ; done
  7. Create a repository on GitHub
  8. Add repo you created in step #2.1 above to the SVN project you checkout

    $ git remote add upstream https://github.com/<organization>/<path_to_repo>
  9. Push code to GitHub repo

    $ git push -u upstream --all
    $ git push -u upstream --tags