Showing posts with label Mavericks. Show all posts
Showing posts with label Mavericks. Show all posts

Sunday 20 April 2014

MySQL JDBC Connector on Mac OSX

If you're working on any Java based program which uses MySQL as it's back-end database, you might find this article extremely helpful.

In order to pull data from the MySQL database, it is first important to establish a connection with it so that the script can talk with it.

The connection can be established by using the MySQL JDBC driver. Now, this driver needs to be separately downloaded. Here's the download link btw. If you're working on Mac OSX, please select the platform-independent version of the Connector from the drop down.

Once downloaded, untar the tar (or unzip the zip file). Copy the mysql-connector-x.x-bin.jar to /Library/Java/Extensions.

If you're using Eclipse IDE for editing class files, you need to make some changes in Eclipse's preferences. So go to Eclipse -> Preferences -> Java -> User Libraries. Click 'New' to create a new user library named as "MYSQL_CONNECTOR_LIBRARY" for instance. Now, click "Add External JARs..." button and browse to the downloaded jar : mysql-connector-x.x-bin.jar.

So if you're Java application is trying to connect to MySQL database, the following code snippet might come in handy for quick reference.

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;


try {

connection=DriverManager.getConnection("jdbc:mysql://localhost:3306", "username", "password");

}

Tuesday 3 December 2013

Macbook Pro Battery Tips


  • Macbook Pro is one of the few laptops that have had the best battery performance in my opinion. Having used Dell and HP laptops loaded with Windows OS, in the past, it was evident how quickly the battery runs out of juice. Macbook Pro's on the other hand has had really good battery performance. I've heard that the Macbook Air has much better battery performance.

  • However, ever since Apple released the OSX Mavericks free upgrade, a lot of users have complained about battery issues. Infact the hullabaloo about battery issues is so loud, that I've refrained from upgrading to Mavericks even if it's free. As a matter of fact, if you see the 200+ feature list for the upgrade, you'll notice that a majority of 'new' features are useless. So instead, I just upgraded the Safari browser along with the other regular app updates. However, ever since Safari was updated to v6.1 even my battery drains out quite fast. I have a feeling that the Safari browser is a lot buggier than its previous versions and tends to max out the CPU and memory consumption - thereby draining out battery much faster.

  • Inorder to keep a track on the battery shelf life I've started to use an app called Coconut Battery. Its a small little utility to monitor the battery statistics. One good feature I liked about it is you can save data on various dates and keep a track on the charge cycles. My 15" MBP is more than 2 yrs old and has had close to 200 cycles by now. As per Apple's support article, my model supports a max cycle count of 1000.



  • I also read somewhere that the battery performance usually gets deteriorated due to overheating. Overheating happens when you run multiple apps which use system resources heavily. So it would help to keep a check on the battery temperatures as well. Deteriorating batteries tend to bloat and bulge thereby affecting the internals. You can check some apple discusiion forums about the same here.

  • You can also calibrate the battery by going powerless once in a while and allow the battery to completely drain out. Then let the laptop cool for some time. Once cooled down, plugin the power cord and restart again.
Related Posts Plugin for WordPress, Blogger...
eXTReMe Tracker