Showing posts with label Mysql. Show all posts
Showing posts with label Mysql. Show all posts

Saturday

JSP connection with MYSQL in Linux

0 comments
Now Let us  see how to connect jsp (Java Server Page) with Mysql in Linux - Ubuntu, mint, debian,. Java server page is a technology used to create dynamic web pages & server-side scripting language. It is similar to php but uses java programming language.

To run a jsp we need a web server,
   1.  Install  tomcat server in your system :
            by giving the following command in terminal

                          sudo apt-get install tomcat7      
          You can install a new version(version-8 ) of tomcat by specifying the version number in the  command.
 
          To test whether tomcat installed properly
         Open your browser & type the following URL:

                             http://localhost:8080/

             You will get the following result


  
  Install JDBC Driver :
                  To make a connection between JSP & Mysql, install a JDBC(connector/J) driver .
                     
                          Download mysql-connector-java-version-bin.zip
                                         link to Download
                          Extract the zip and get the mysql-connector-java-5.1.13-bin.jar file
                          Copy the .jar file to  the following location
                     
                                     filesystem/usr/share/tomcat6/lib
                                                       i.e
                                           /usr/share/tomcat6/lib
                       
      Restart the tomcat server :
              
                           sudo /etc/init.d/tomcat7 start
                                          sudo /etc/init.d/tomcat7 stop

    Apache tomcat server can be restarted by using following single cmd also.
                                          sudo /etc/init.d/tomcat6 restart 


         Now Let us create a Sample JSP with Mysql connection.  
                   
                  test.jsp

<!DOCTYPE HTML>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<html>

Friday

How to connect MYSQL with PHP

0 comments
 
            Mysql is back-end software which is used to store several data . Once the connection is made
between Mysql and PHP you can store and access data in mysql from the front end(browser).

 Let us see the php code to connect with your database .


<?php
$con=mysql_connect("localhost","Username ","Passwrd");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$dbs = mysql_select_db("database_name");
?>
    Username - root       (If you are running in localhost) .
    Password - Your own mysql password .

$dbs = mysql_select_db("database_name");
  The above line is used to select the database ,so that you can access the data in it ..


                *****    Like us in FB & get updates ...... LIKE      *****

Sunday

How to back up MySQL database

0 comments
     MySQL is  an efficient backend software and it is also an open source .
Usually there are two ways to backup a database or the tables in database
 1.  Using commands
 2.  Using Phpmyadmin
Using phpmyadmin will be easier and better method .

   Phpmyadmin make you to create,update,delete,backup database with easy clicks ...

1.) Install phpmyadmin in your system
                -For Linux system
                        sudo apt-get install phpmyadmin
2.) Open the installed phpmyadmin software in your browser
                               http://localhost/phpmyadmin

 3.)  Login us  a root , give the password that you have set during installation

       
         Now you have various options like creating database and tables , import and export database .