First Method:
1. sudo zypper install mysql-connector-java (or go to Software Management and search for jdbc, you will find mysql-connector-java package).
2. Once it's installed, you'll have the file /usr/share/java/mysql-connector-java.jar (/usr/share/java/mysql.jar), which is an indirect symlink to the actual jar file.
3. in Eclipse, do this as: Project -> Properties -> Java Build Path -> Libraries -> Add External JARs -> select /usr/share/java/mysql-connector-java.jar
Or, Second Method:
Download the MySQL JDBC connector from http://www.mysql.com/downloads/connector/j/5.1.html.
[Platform Independent (Architecture Independent), Compressed TAR Archive]
Extract the JDBC driver JAR file from the downloaded file; for example:
tar zxvf mysql-connector-java-5.1.39.tar.gz
Add the JDBC driver, renamed, to the relevant server; for example:
$ sudo cp mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar /usr/share/java/mysql-connector-java.jar
If the target directory does not yet exist on this host, you can create it before copying the .jar file; for example:
$ sudo mkdir -p /usr/share/java/
$ sudo cp mysql-connector-java-5.1.39/mysql-connector-java-5.1.39-bin.jar /usr/share/java/mysql-connector-java.jar
I did the first method.
******************************
Test if JDBC Connection is Suffessful:
import java.sql.*;
class JdbcTest{
public static void main(String[] args) throws Exception {
System.out.println("Connecting database...");
Connection connection = null;
String url = "jdbc:mysql://localhost:3306/cs_project";
String username = "root";
String password = "vijaya";
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(url, username, password);
System.out.println("Connection Successful.");
// Success.
} catch (SQLException e) {
// Fail.
System.out.println("Connection Failed."+e);
} finally {
if (connection != null) try { connection.close(); } catch (SQLException ignore) {}
}
}
}
All about Computer Science | Linux: OpenSUSE, Red Hat, CentOS, Fedora| RPM Package Manager (RPM) (Red Hat Package Manager)| Programming Concepts | Java | Python | Life Hacks | Microsoft Windows | Tutorials...
Showing posts with label OpenSUSE. Show all posts
Showing posts with label OpenSUSE. Show all posts
Tuesday, June 28, 2016
Tuesday, June 21, 2016
Install Sublime Text on OpenSUSE
Download Sublime Text tarball from the following link:
http://www.sublimetext.com/3
(Ubuntu 64 bit - also available as a tarball for other Linux distributions.)
Extract the downloaded file sublime_text_3_build_3114_x64.tar.bz2
Once unpacked, you will get a directory called “sublime_text_3″, inside this directory you will see a list files that required by Sublime Text to run.
For example, go to the folder sublime_text_3 and open new terminal window and type ./sublime_text, sublime text editor will open. But everytime, doing this way to open a sublime text editor is not a good idea.
For security reason, we move this folder under “/opt” location. For this enter the following command:
sudo mv sublime_text_3 /opt/
sudo mv Sublime\ Text\ 3 /opt/ (if folder name is Sublime Text 3)
Next create a symbolic link to call “Sublime Text” from the command line as “sublime”. To do, create a symbolic link under “/usr/bin” as shown below.
sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime
Now, you are ready to use sublime text. Just type sublime in terminal, sublime text editor will open.
http://www.sublimetext.com/3
(Ubuntu 64 bit - also available as a tarball for other Linux distributions.)
Extract the downloaded file sublime_text_3_build_3114_x64.tar.bz2
Once unpacked, you will get a directory called “sublime_text_3″, inside this directory you will see a list files that required by Sublime Text to run.
For example, go to the folder sublime_text_3 and open new terminal window and type ./sublime_text, sublime text editor will open. But everytime, doing this way to open a sublime text editor is not a good idea.
For security reason, we move this folder under “/opt” location. For this enter the following command:
sudo mv sublime_text_3 /opt/
sudo mv Sublime\ Text\ 3 /opt/ (if folder name is Sublime Text 3)
Next create a symbolic link to call “Sublime Text” from the command line as “sublime”. To do, create a symbolic link under “/usr/bin” as shown below.
sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/sublime
Now, you are ready to use sublime text. Just type sublime in terminal, sublime text editor will open.
Sunday, June 19, 2016
Changing Extension to Multiple Files on OpenSUSE
To change extension of multiple files (suppose all .txt files to .jpg), open terminal and execute the following command:
rename txt jpg *.txt
Explanation: here, it replaces the every occurrence of txt to jpg in all file matching "*.txt"
To change back to .txt, execute the following command:
rename jpg txt *.jpg
rename txt jpg *.txt
Explanation: here, it replaces the every occurrence of txt to jpg in all file matching "*.txt"
To change back to .txt, execute the following command:
rename jpg txt *.jpg
Friday, February 26, 2016
Install Adobe Flash Player Plugin on Firefox [OpenSUSE]
Go to:
https://get.adobe.com/flashplayer/
Select Version to download from the list. I picked:
.rpm for other linux
Choose one click install
Done!
https://get.adobe.com/flashplayer/
Select Version to download from the list. I picked:
.rpm for other linux
Choose one click install
Done!
ImportError: No module named [OpenSUSE]
ImportError when importing Tkinter in Python:
sudo zypper install python-tk
sudo zypper install python-tk
Wednesday, February 10, 2016
Connect VPN Client on OpenSUSE
Once you install the vpnsetup.sh file using the following command:
sudo sh yoursetupfile.sh
your vpn software will be installed on the following location:
/opt/cisco
Now, navigate to:
/opt/cisco/anyconnect/bin
Open Terminal and Enter the following command:
./vpn connect vpn.nmsu.edu
sudo sh yoursetupfile.sh
your vpn software will be installed on the following location:
/opt/cisco
Now, navigate to:
/opt/cisco/anyconnect/bin
Open Terminal and Enter the following command:
./vpn connect vpn.nmsu.edu
Then you'll see the following screen:
Cisco AnyConnect Secure Mobility Client (version 3.1.04072) .
Copyright (c) 2004 - 2013 Cisco Systems, Inc. All Rights Reserved.
>> state: Disconnected
>> state: Disconnected
>> notice: Ready to connect.
>> registered with local VPN subsystem.
>> contacting host (vpn.nmsu.edu) for login information...
>> notice: Contacting vpn.nmsu.edu.
>> Connection Banner
>> ©2014 NMSU Board of Regents
>> Please enter your myNMSU username and password.
0) NMSU
1) NMSU-Full
2) banner
Group: [NMSU]
Enter NMSU as a group.
Then, you'll be asked to enter username. Enter your nmsu username
Then, finally enter your nmsu password and you're done.
If you want to check if the connection is established, enter the following command again
./vpn connect vpn.nmsu.edu
and you'll see:
Cisco AnyConnect Secure Mobility Client (version 3.1.04072) .
Copyright (c) 2004 - 2013 Cisco Systems, Inc. All Rights Reserved.
>> state: Connected
>> state: Connected
>> notice: Connected to Not Available.
>> registered with local VPN subsystem.
>> contacting host (vpn.nmsu.edu) for login information...
>> state: Connected
>> state: Connected
Install .sh file on Opensuse
1. Download the .sh file
2. Navigate to the location where .sh file is located
3. Type the following command:
sudo sh yoursetupfile.sh
Now you're done!
2. Navigate to the location where .sh file is located
3. Type the following command:
sudo sh yoursetupfile.sh
Now you're done!
Thursday, January 28, 2016
Install PhpStorm on OpenSUSE
1. Download PhpStorm from JetBrains
2. Unzip the folder and copy it into a destination where you want to keep.
3. Go To the copied folder and navigate into Bin folder.
4. In a bin folder, open terminal window.
5. Type ./phpstorm.sh and hit Enter
6. Then you're done! :)
2. Unzip the folder and copy it into a destination where you want to keep.
3. Go To the copied folder and navigate into Bin folder.
4. In a bin folder, open terminal window.
5. Type ./phpstorm.sh and hit Enter
6. Then you're done! :)
Kate Terminal Not Working on OpenSUSE
If Kate terminal is not working on your OpenSUSE device, it might be because of konsole not being installed on your computer.
Just enter the following command in terminal to install konsole:
sudo zypper in konsole
and then it should work.
Good Luck!
Just enter the following command in terminal to install konsole:
sudo zypper in konsole
and then it should work.
Good Luck!
Wednesday, November 25, 2015
How to Add Low Battery Warning on OpenSUSE
Simply follow these steps:
If you prefer to do it using a GUI, you can go to the Software Center and install Scheduled tasks (or run sudo zypper install gnome-schedule). It will provide a powerful GUI to add cron tasks.
Note that if you use this method, tasks by default will be executed as your own user, not as root. This is usually a good thing.
Once installed this application, search "Scheduled Tasks" and Open it.
Now, Click on New
Click on "A task that launches recurrently"
Now Add description for example: VK Battery Check
On the command, Add: /home/vkpandey/Extras/scripts/CheckBattery.sh
On the Time and Date Option, click on Advanced
In the Minute section, add */5 that means at minute: */5 (in every 5 minutes)
and leave Hour, Day, Month, Weekday *
Now create a following CheckBattery.sh script in any location (For example: /home/vkpandey /Extras/scripts)
#!/bin/bash**Don't forget the file permission of CheckBattery.sh
BATTERY=$(upower -e | grep 'BAT')
while [ 1 ]
do
BATTERY_PERCENTAGE=$(upower -i $BATTERY|grep percentage|awk '{ print $2 }'|sed s/'%'/''/g)
if [[ "$BATTERY_PERCENTAGE" -lt "20" ]]; then
notify-send --urgency=critical "WARNING: Battery is about to die" "Hello Vijaya!! Plug in the power cable"
play /usr/share/sounds/KDE-Sys-Warning.ogg &> /dev/null
fi
sleep 10
done
Now All Done!
Assign Win + E Key to Open Home Folder [OpenSUSE]
Here is the trick to Assign Win + E Key to Open Home Folder [OpenSUSE]:
1. go to Settings.
2. search for Keyboard.
3. Move to tab "shortcuts"
4. Go to Launchers
5. Click on "Home Folder" option.
6. Click on the right side (you will see New Accelerator or something)
7. press windows + E (also called Super + E)
8. Now on the right side it shows "Super + E"
Finally you're done. That will create a keyboard shortcut to open home folder. Press Super + E to see the result.
1. go to Settings.
2. search for Keyboard.
3. Move to tab "shortcuts"
4. Go to Launchers
5. Click on "Home Folder" option.
6. Click on the right side (you will see New Accelerator or something)
7. press windows + E (also called Super + E)
8. Now on the right side it shows "Super + E"
Finally you're done. That will create a keyboard shortcut to open home folder. Press Super + E to see the result.
Monday, November 23, 2015
Show Desktop Items on OpenSUSE
To show the desktop items on OpenSUSE, follow these steps:
1. Type Tweak Tool on search bar.
2. Go to Desktop tab
3. On the Top Right Side, change Off button to On.
Now, you're all set.
1. Type Tweak Tool on search bar.
2. Go to Desktop tab
3. On the Top Right Side, change Off button to On.
Now, you're all set.
How to Hide All Normal Windows on OpenSUSE?
Here is the trick to show desktop / hide all normal windows on OpenSUSE:
1. go to Settings.
2. search for Keyboard.
3. Move to tab "shortcuts"
4. Go to Navigation
5. Scroll down to find "Hide All Normal Windows".
6. Click on the right side (you will see New Accelerator or something)
7. press windows + D (also called Super + D)
8. Now on the right side it shows "Super + D"
Finally you're done. Press Super + D to see desktop.
1. go to Settings.
2. search for Keyboard.
3. Move to tab "shortcuts"
4. Go to Navigation
5. Scroll down to find "Hide All Normal Windows".
6. Click on the right side (you will see New Accelerator or something)
7. press windows + D (also called Super + D)
8. Now on the right side it shows "Super + D"
Finally you're done. Press Super + D to see desktop.
Monday, November 16, 2015
Create a File in OpenSUSE using Terminal Window
Use:
touch
command.
For example:
touch submit_vijaya.docx
Wednesday, November 11, 2015
Run Gringo/Clingo Successfully on OpenSUSE [Gringo Not Working on OpenSUSE - FIXED!]
With the recent gringo/clingo sources, no configuration should be necessary (under (most) linuxes).
However you have to make sure the installation of the development package of python.
To install the necessary packages:
For threading support, you also need Intel's tbb. It is in the education repository.
However you have to make sure the installation of the development package of python.
To install the necessary packages:
sudo zypper in python-devel lua-devel bison scons re2c
For threading support, you also need Intel's tbb. It is in the education repository.
sudo zypper in tbb-devel
Add Clingo Path to Environment Variable [OpenSUSE]
1. Open Terminal
2. Type the following Command:
3. Add the following content
4. To save and exit, click "Shift" + ":" together and type "wq" and press Enter.
Now you're all done.
To ensure you did it right, type:
2. Type the following Command:
vi ~/.bashrc
export PATH=$PATH:~/Documents/clingo-4.5.3/
Now you're all done.
To ensure you did it right, type:
clingo
Saturday, November 7, 2015
Friday, November 6, 2015
Remove Folder using Terminal on OpenSUSE
To remove:
1. Open Terminal
2.Type:
1. Open Terminal
2.Type:
sudo rm -r Clang
[here, if you're not in a current directory, give full path]
Find OpenSUSE Version using Terminal
A quick way to find which version of OpenSUSE you're using:
1. Open Terminal
2. Type:
UPDATE:
/etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
1. Open Terminal
2. Type:
cat /etc/SuSE-release
That will show you the result. UPDATE:
/etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
Subscribe to:
Posts (Atom)