Aptitude
(12)
C
(2)
C++
(10)
CSS
(1)
Data Structure
(2)
English
(6)
Fitness
(2)
General
(14)
HTML
(3)
Integration
(1)
Itinerary and Travel Cost
(2)
Java
(29)
JQ
(5)
JS
(5)
JSP
(1)
Lightning
(14)
logical
(3)
Lyrics
(1)
Math
(1)
Music Notation
(20)
MySql
(4)
Network
(1)
Regex
(1)
salesforce
(131)
Servlet
(4)
SF Admin
(31)
SF Dev
(102)
Spiritual Content
(3)
SQL
(4)
SQL_SERVER
(1)
StudyPoints
(2)
Trips
(1)
ytChannels
(2)
अन्ताक्षरी
(4)
Package Demo
Package demo:
Creating a user define package
- A package is a folder having related set of classes
- Two packages can have classes with same name
- Such packages get placed into some folder on some driver
- It works as a library for any project
Steps
- Create a folder as container of your packages
- d:\mypackages
- Think your package names and created sub folders with those names under your container folder
- E.g. p1 and p2
- Create your classes and place them into these folders
- Each class must have package command on top
Example
Create a class as General having some general methods like SquareRoot, CubeRoot and place it into p1 package
Create another class as Sample in package p2 having some sample method like Hi(), Hello()
Create a class UsingPackage where input a number from keyboard and print square root and cube root of that number using the class General of p1 package.
Note: To search the classes inside the packages, we need to define the CLASPATH
CLASSPATH is an environment variable to search the class files
For Kawa
Packages à classpath à Add Dir… à Select the folder name having the packages
D:\mypackages
For DOS
- Set the CLASSPATH using
o SET CLASSPATH=%CLASSPATH%;d:\mypackages;
For NetBeans
- Select Libraries Properties
§ Add Jar/Dir…
Note:
Remember every properties of classes,methods,packages etc. otherwise you can find such types of errors:
1.--------------------------- Compiler Output ---------------------------
UsingPackage.java:1: package p1 does not exist import p1.*; ^ UsingPackage.java:11: cannot find symbol symbol : variable MyClass location: class UsingPackage System.out.println("Square root is : "+MyClass.square(n)); ^ 2 errors
2. --------------------------- Compiler Output ---------------------------
UsingPackage.java:11: square(int) is not public in p1.MyClass; cannot be accessed from outside package System.out.println("Square root is : "+MyClass.square(n)); ^ 1 error
3. --------------------------- Compiler Output ---------------------------
UsingPackage.java:11: square(int) is not public in p1.MyClass; cannot be accessed from outside package System.out.println("Square root is : "+MyClass.square(n)); ^ 1 error
TweetTake a backup or Restore backup on same version DB
You can copy all the files or selected files from the data folder of installed mysqls server folder.
and you can paste it on other computers. note that the version of mysql shloud be same from where you cpoied and to where you want past
and you can paste it on other computers. note that the version of mysql shloud be same from where you cpoied and to where you want past
Take a backup or Restore backup
1. Go to download paath of MySql administrator and download it.
2.Install the above downloaded software on your Computer where mysql database be already installed.
3. After installing the above software ,Run this software.
4.It will demand password of your MySql server. So Enter your MaSql server password which s/w is already installed on your computer.
5.Now You will take backup or Restore your backup in/from .sql format.
6. a screensot is given below
.
Tweet
2.Install the above downloaded software on your Computer where mysql database be already installed.
3. After installing the above software ,Run this software.
4.It will demand password of your MySql server. So Enter your MaSql server password which s/w is already installed on your computer.
5.Now You will take backup or Restore your backup in/from .sql format.
6. a screensot is given below
.
Tweet
A very simple way for connecting MySQL
- Make a lib names folder inside WEB-INF folder of your project.
- Go to Download This MySQL connector .JAR file and download it.
- Place the above downloaded jar file inside the lib folder which is created in step 1.
- now place your servlet's classes file into classes folder.
- place web.xml file of your project into WEB-INF folder.
- Run tomcate and enter your project's running URL.
- Process completed.
Connection to Mysql Database and Run servlet action with database
1.Got to Download path of mysql connector .jar (Dot JAR ) file and download it.
2.extract this jar file wheather with the help of command prompt or with the help of RAR zip extractor.
3.After extracting mysql connector jar file,we will find three folder
· Com
· META-INF
· org
5.Copy com folder .
6. Paste above copied folder into the classes folder of your project’s WEB-INF folder.
7. Now we are connected with Mysql database.
8.write your servlet program importing sql package.
Include in this program points given below or make then import a package of confgiration of points given below then import:
a. use of class.forName() method
b. use of getConnection() of the DriverManager class.
c.use of createStatement,excuteUpdate,etc….
9.compile your servlet program.
10.copy the classes files.
11.paste those into the classes folder of project’s WEB-INF folder .
12.make web.xml file
13.run tomcat.
14.enter your URL as localhost:potnumberas 8080/application folder name/url of main servlet file which is included in web.xml file of project
e.g. http://localhost:8080/di/DataInsertion
15.Process completed
Tweet
Subscribe to:
Posts (Atom)