{"id":522,"date":"2013-03-10T17:56:52","date_gmt":"2013-03-10T16:56:52","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=522"},"modified":"2014-07-05T11:13:52","modified_gmt":"2014-07-05T09:13:52","slug":"java-survival-guide","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=522","title":{"rendered":"Java Survival Guide"},"content":{"rendered":"<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#Installation\"><span class=\"toc_number toc_depth_1\">1<\/span> Installation<\/a><\/li><li><a href=\"#Configuration\"><span class=\"toc_number toc_depth_1\">2<\/span> Configuration<\/a><\/li><li><a href=\"#JDBC_URLs\"><span class=\"toc_number toc_depth_1\">3<\/span> JDBC URLs<\/a><ul><li><a href=\"#Mysql_ConnectorJ\"><span class=\"toc_number toc_depth_2\">3.1<\/span> Mysql (Connector\/J)<\/a><\/li><li><a href=\"#PostgreSQL\"><span class=\"toc_number toc_depth_2\">3.2<\/span> PostgreSQL<\/a><\/li><li><a href=\"#Microsoft_SQL_Server_jTDS_Driver\"><span class=\"toc_number toc_depth_2\">3.3<\/span> Microsoft SQL Server (jTDS Driver)<\/a><\/li><li><a href=\"#Microsoft_SQL_Server_Microsoft_Driver\"><span class=\"toc_number toc_depth_2\">3.4<\/span> Microsoft SQL Server (Microsoft Driver)<\/a><\/li><li><a href=\"#Oracle\"><span class=\"toc_number toc_depth_2\">3.5<\/span> Oracle<\/a><\/li><\/ul><\/li><\/ul><\/div>\n<h1><span id=\"Installation\">Installation<\/span><\/h1>\n<p>Download java version from <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/index.html\">here<\/a><br \/>\nNote : we will use this one : jdk-6u43-linux-x64.bin<\/p>\n<p>Install it:<\/p>\n<pre lang=\"bash\">\r\nchmod a+x jdk-6u43-linux-x64.bin\r\n.\/jdk-6u43-linux-x64.bin\r\n<\/pre>\n<h1><span id=\"Configuration\">Configuration<\/span><\/h1>\n<p>Add to your ~\/.bashrc the following environment var:<\/p>\n<pre lang=\"bash\">\r\nexport JAVA_OPTS=\u201d-Xms1024m -Xmx1024m -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled\"\r\nexport JAVA_HOME=\/opt\/java\/jdk1.6.0_43\r\nexport PATH=$PATH:$JAVA_HOME\/bin\r\n<\/pre>\n<ul>\n<li>The CMSPermGenSweepingEnabled setting includes the PermGen in a garbage collection run. By default, the PermGen space is never included in garbage collection (and thus grows without bounds).<\/li>\n<li> The CMSClassUnloadingEnabled setting tells the PermGen garbage collection sweep to take action on class objects. By default, class objects get an exemption, even when the PermGen space is being visited during a garabage collection. <\/li>\n<\/ul>\n<p>And reload your shell:<\/p>\n<pre lang=\"bash\">\r\nsource ~\/.bashrc\r\n<\/pre>\n<p>Check all is ok:<\/p>\n<pre lang=\"bash\">\r\njava -version\r\n<\/pre>\n<h1><span id=\"JDBC_URLs\">JDBC URLs<\/span><\/h1>\n<h2><span id=\"Mysql_ConnectorJ\">Mysql (Connector\/J)<\/span><\/h2>\n<p>* Driver Class: com.mysql.jdbc.Driver<br \/>\n* Default Port: 3306<br \/>\n* JDBC URL : jdbc:mysql:\/\/[host][,failoverhost&#8230;][:port]\/[database]<\/p>\n<h2><span id=\"PostgreSQL\">PostgreSQL<\/span><\/h2>\n<p>* Driver Class: org.postgresql.Driver<br \/>\n* Default Port: 5432<br \/>\n* JDBC URL : jdbc:postgresql:\/\/host:port\/database?user=userName&#038;password=pass<\/p>\n<h2><span id=\"Microsoft_SQL_Server_jTDS_Driver\">Microsoft SQL Server (jTDS Driver)<\/span><\/h2>\n<p>* Driver Class: net.sourceforge.jtds.jdbc.Driver<br \/>\n* Default Port: 1433<br \/>\n* JDBC URL : jdbc:jtds:sqlserver:\/\/server\/db;user=userName;password=password<\/p>\n<h2><span id=\"Microsoft_SQL_Server_Microsoft_Driver\">Microsoft SQL Server (Microsoft Driver)<\/span><\/h2>\n<p>* Driver Class: com.microsoft.jdbc.sqlserver.SQLServerDriver<br \/>\n* Default Port: 1433<br \/>\n* JDBC URL : jdbc:microsoft:sqlserver:\/\/host:port;databasename=name;user=yourUser;password=yourPwd<\/p>\n<h2><span id=\"Oracle\">Oracle<\/span><\/h2>\n<p>* Driver Class: oracle.jdbc.driver.OracleDriver<br \/>\n* Default Port: 1521<br \/>\n* JDBC URL : jdbc:oracle:thin:@server:port:databasename;user=userName;password=password<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 Installation2 Configuration3 JDBC URLs3.1 Mysql (Connector\/J)3.2 PostgreSQL3.3 Microsoft SQL Server (jTDS Driver)3.4 Microsoft SQL Server (Microsoft Driver)3.5 Oracle Installation Download java version from here Note : we will use this one : jdk-6u43-linux-x64.bin Install it: chmod a+x jdk-6u43-linux-x64.bin .\/jdk-6u43-linux-x64.bin Configuration Add to your ~\/.bashrc the following environment var: export JAVA_OPTS=\u201d-Xms1024m -Xmx1024m -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled&#8221; export [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":440,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-522","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=522"}],"version-history":[{"count":11,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/522\/revisions"}],"predecessor-version":[{"id":921,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/522\/revisions\/921"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/440"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}