Thursday, October 25, 2012

Code used in video "Java prog#7. Database is locked problem solution in Java Netbeans and Sqlite (mysql)"

HERE I AM PROVIDING THE downloadable CODE LINK OF  THE JAVA CODE I HAVE USED IN THE VIDEO  "Java prog#7. Database is locked problem solution in Java Netbeans and Sqlite (mysql)"  OF MY YOUTUBE CHANNEL PROGRAMMINGKNOWLEDGE

Click Link to watch the video LINK

This code below is for the example of method action perform



   
 private void Fillcombo(){   

try{
  String sql="select * from Empoyeeinfo";
  pst=conn.prepareStatement(sql);
   rs=pst.executeQuery();
   
   while(rs.next()){
   String name =rs.getString("name");
   ComboBox_name.addItem(name);
   
   }

}catch(Exception e){

JOptionPane.showMessageDialog(null, e);

} 
///This is the main code for the  block DATABASE IS LOCKED PROBLEM SOLUTION
finally {
try{
  rs.close();
      pst.close();
    // conn.close();
  }
  catch(Exception e) {
                   }
      } 


}


Java prog#7. Database is locked problem solution in Java Netbeans and Sqlite (mysql)





Jave Netbeans and Sqlite (mysql) Database is locked problem solution.
Just paste the code-block after every try catch block

 finally {
try{
  rs.close();
      pst.close();
    
  }
  catch(Exception e) {
                   }
      }




The SQLite wiki DatabaseIsLocked page offers a good explanation of this error message. It states, in part, that the source of contention is internal (to the process emitting the error).

http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked

What this page doesn't explain is how SQLite decides that something in your process holds a lock and what conditions could lead to a false positive.

[Solved] sqlite database lock problem
Sqlite locking problem
Sqlite: Database is Locked error and unlocking the database
 "Database is locked" problem with sqlite
iit Learn     java netbeans
java tutorial netbeans

Code used in video "Java prog#6. How to link jcombobox with database in Netbeans Java and Sqlite (mysql)"


Here I am providing the downloadable code link of  the java code I have used in the video  "Java prog#6. How to link jcombobox with database in Netbeans Java and Sqlite (mysql)"  of my YouTube channel ProgrammingKnowledge


Click Link to watch the video LINK


This code below is for the Fillcombo() method action perform



private void Fillcombo(){
 
 
try{
  String sql="select * from Empoyeeinfo";
  pst=conn.prepareStatement(sql);
   rs=pst.executeQuery();
 
   while(rs.next()){
   String name =rs.getString("name");
   ComboBox_name.addItem(name);
 
   }

}catch(Exception e){

JOptionPane.showMessageDialog(null, e);

} finally {
try{
  rs.close();
      pst.close();
    // conn.close();
  }
  catch(Exception e) {
                   }
      }

}


Java prog#6. How to link jcombobox with database in Netbeans Java and Sqlite (mysql)




Jave Netbeans and Sqlite (mysql) populate jcombobox

In this video I have tried to show how to use jcombobox with database
ComboBox for Java using NetBeans
java netbeans and mysql  populate combo box
binding jComboBox to mysql database
How to get the selected Text in JComboBox?
populating combo box
Fill JComboBox with MySQL data Netbeans
Adding items to a jComboBox
Populating Combo Box Selections With NetBeans - Java
Fill JComboBox with MySQL data
Java - JComboBox - Obtain Values
How Use the Combo Box With Netbeans GUI
Combo Box in Netbeans
java - How do I populate jcombobox from a textfile?
jComboBox demo
Netbeans IDE Users - JCombo Box using Net Beans
How To Add Jcombobox List From Database?
link jcombobox with database
Jcombobox with database help
JAVA - How do I populate a jcombobox with information from a mySQL database?
iit Learn     java netbeans
java tutorial netbeans

Code used in video "Java prog#5. JTable- Populate JTable data from database in java Netbeans and Sqlite (mysql)"


Here I am providing the downloadable code link of  the java code I have used in the video  "Java prog#5. JTable- Populate JTable data from database in java Netbeans and Sqlite (mysql)"  of my YouTube channel ProgrammingKnowledge


Click Link to watch the video LINK

This code below is for the Update table method action perform



private void Update_table(){
  //timer.start();

    try{
    String sql ="select * from Empoyeeinfo  ";
   pst=conn.prepareStatement(sql);
   rs=pst.executeQuery();
   Table_Employee.setModel(DbUtils.resultSetToTableModel(rs));
 
 
    }
    catch(Exception e){
    JOptionPane.showMessageDialog(null, e);
 
     }

}


Java prog#5. JTable- Populate JTable data from database in java Netbeans and Sqlite (mysql)




Yuo have to download the rs2xml.jar file in order to populate the Jtable.
I am providing you the link to download rs2xml.jar file below

http://www.general-files.com/download/gs39f4b18chfi0/rs2xml.jar.html

Jave Netbeans and Sqlite  (mysql)  populate or use jtable



java netbeans and mysql  populate jtable
java - How to fill data in a JTable with database
How to retrieve data from a jTable in Java
Jtable Database
Populate data from database into JTable in Netbeans
populate JTable from database
java - What is the best way to populate a JTable using MYSQL
How To Fill Jtable Using Sql Select Statement?
java - how to display all the data from the database to jtable?
NetBeans Forums - jtable and report from mysql database
How to set data from database to jtable?
JTable how to fill with data
How to Make a JTable in NetBeans
how to fill data in jtable from database on button click in java
Retrieving data in a JTable
How to get data in MySQL table into Java JTable?
How can I make a JTable cell do different things on single-click
Values to be displayed in JTextfield when Clicked on JTable Cells.
Click on JTable Model Updates JTextfield
how can i get value from JTable and set it to textfield.
Show data from JTable in Jtextfield
Sharing document between JTable Cells and JTextFields
get jtextfield from jtable
iit Learn     java netbeans
java tutorial netbeans

Code used in video "Java prog#3. Login Program for Netbeans java with sqlite [ Mysql ] database PART-1" and "Java prog#3. Login Program for Netbeans java with sqlite [ Mysql ] database PART-2"

Here I am providing the downloadable code link of  the java code I have used in the video
 " "Java prog#3. Login Program for Netbeans java with sqlite [ Mysql ] database PART-1" and  "Java prog#3. Login Program for Netbeans java with sqlite [ Mysql ] database PART-2""  of my YouTube channel ProgrammingKnowledge


Click Link to watch the video LINK


This code below is for the Login button action perform


    private void cmd_loginActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        String sql ="select * from Empoyeeinfo where username=? and password=?";
        try{
        pst=conn.prepareStatement(sql);
        pst.setString(1,txt_username.getText());
        pst.setString(2,txt_password.getText());
        //////////////////////////////////////////////
        ///////////
        rs=pst.executeQuery();
        if(rs.next()){
        JOptionPane.showMessageDialog(null, "Username and Password is correct ");
  rs.close();
      pst.close();
       close();
        Employee_info s =new Employee_info();
       s.setVisible(true);
     
        }
        else{
         JOptionPane.showMessageDialog(null, "Username and Password is not correct");
     
     
        }
        }
        catch(Exception e)
    {
           JOptionPane.showMessageDialog(null, e);

    } finally {
try{
  rs.close();
      pst.close();
 
  }
  catch(Exception e) {
                   }
      }
    }


If you have question in mind that  How can we give roles between the manager and the rest of the users...............then follow the code below.... This code below is for the Login button action perform for  the manager and the rest of the users.....



 private void cmd_loginActionPerformed(java.awt.event.ActionEvent evt) {
try{

int count=0;

String sql="select * from employee_data where username =? and userpassword =? and Division =? ";

pst =conn.prepareStatement(sql);



pst.setString(1, txt_username.getText());
pst.setString(2, txt_password.getText());



pst.setString(3, txt_userlevel.getSelectedItem().toString());

rs=pst.executeQuery();



//query for welcome name
{
}
while(rs.next()){



count=count+1;

}

String division= (txt_userlevel.getSelectedItem().toString());

if(division=="Top") {


if(count==1){

JOptionPane.showMessageDialog(null, "Username and password correct");

User_JFrame p= new User_JFrame();

//Admin_HR_JFrame p = new Admin_HR_JFrame();

p.setVisible(true);

close();

}

else if(count>1){

JOptionPane.showMessageDialog(null, "Duplicate user and password Access denied");
// Level_1_JForm s = new Level_1_JForm();

//s.setVisible(true);

}

else{

JOptionPane.showMessageDialog(null, "Username and password not correct");

}

} 

else if(division=="Manager"){

if(count==1){

JOptionPane.showMessageDialog(null, "Username and password correct");


Competency_Form_JFrame s = new Competency_Form_JFrame();

s.setVisible(true);

close();

}

else if(count>1){

JOptionPane.showMessageDialog(null, "Duplicate user and password Access denied");
// Level_1_JForm s = new Level_1_JForm();



//s.setVisible(true);



}



else{



JOptionPane.showMessageDialog(null, "Username and password not correct");

}

} 

else if(division=="Executive"){

if(count==1){

JOptionPane.showMessageDialog(null, "Username and password correct");

Competency_Form_JFrame s = new Competency_Form_JFrame();



s.setVisible(true);

close();

}

else if(count>1){

JOptionPane.showMessageDialog(null, "Duplicate user and password Access denied");

//Level_1_JForm s = new Level_1_JForm();



//s.setVisible(true);

}

else{

JOptionPane.showMessageDialog(null, "Username and password not correct");

}

} 
else if(division=="Engineer"){



if(count==1){

JOptionPane.showMessageDialog(null, "Username and password correct");

Competency_Form_JFrame s = new Competency_Form_JFrame();

s.setVisible(true);

close();

}

else if(count>1){

JOptionPane.showMessageDialog(null, "Duplicate user and password Access denied");
// Level_1_JForm s = new Level_1_JForm();

//s.setVisible(true);

}

else{

JOptionPane.showMessageDialog(null, "Username and password not correct");

}

} 


else if(division=="DesignEngineer"){

if(count==1){



JOptionPane.showMessageDialog(null, "Username and password correct");


Competency_Form_JFrame s = new Competency_Form_JFrame();

s.setVisible(true);

close();

}

else if(count>1){

JOptionPane.showMessageDialog(null, "Duplicate user and password Access denied");

//Level_1_JForm s = new Level_1_JForm();

//s.setVisible(true);

}

else{

JOptionPane.showMessageDialog(null, "Username and password not correct");

}

} 


}catch(Exception e)

{

JOptionPane.showMessageDialog(null, e);

}
}

Java prog#3. Login Program for java with sqlite [ Mysql ] database PART-1



JPasswordfield
The sql connect jar file can be downloader form this link below




Creating Login Page In Java using NetBeans
code for login using netbeans
Java Netbeans Login
Building a Login Screen for a NetBeans
NetBeans Platform Login Tutorial
create login page contain user id,password,buttons in java using netbeans
NetBeans Platform Login Tutorial
Download Netbeans Login Source Codes


Java prog#3. Login Program for java with sqlite [ Mysql ] database PART-2 



The sql connect jar file can be downloader form this link below

http://code.google.com/p/sqlitebot/downloads/detail?name=sqlitejdbc-v056.jar&can=2&q=

Code used in video "Java prog#2 . Connect Sqlite or MySQL database to Netbeans IDE"

Here I am providing the downloadable code link of  the java code I have used in the video
 "Java prog#2 . Connect Sqlite or MySQL database to Netbeans IDE"  of my YouTube channel ProgrammingKnowledge

Click Link to watch the video LINK


import java.sql.*;
import javax.swing.*;
public class javaconnect {
     Connection conn= null;
    public static Connection ConnecrDb(){
 
    try{
    Class.forName("org.sqlite.JDBC");
     Connection conn =DriverManager.getConnection("jdbc:sqlite:project123.sqlite");
    //JOptionPane.showMessageDialog(null, "Connection Established");
    return conn;
       }catch (Exception e){
           JOptionPane.showMessageDialog(null, e);
       return null;
     
       }
 
    }
}

Java prog#1. Create netbeans project and download SQLite Manager from firefox (web browser)




SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source
code for SQLite is in the public domain


Java prog#2 . Database Connection (Sqlite or MySQL ) to Java 

.


java netbeans and MySQL or SQLite  connecting to database
Connecting to a MySQL Database in Java
connecting to a database with java code
Database Programming with JDBC and Java
Trying to connect to mysql database via JDBC
Connect to MySQL database from Java
What is Jdbc and how you connect Java with database

Hello Everyone


Hello ,
Here I will share my Programming knowledge and experience with you all.....
I  make video tutorials and post it on YouTube and my Blog. These tutorials where about Programming and I did enjoy making them. Answering people's questions was great, and the feeling you get when you solve a problem always felt good. The only problem I had was: making tutorials is a little bit time consuming. It requires planning the subjects that need to be covered, recording the tutorial, editing the video, rendering it and finally uploading it to the site. Usually a one 10 minute tutorials requires about 45 minutes  to finish. Regardless I did enjoy it all.
IT Certification Category (English)640x480

Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Top Online Courses From ProgrammingKnowledge

Python Course http://bit.ly/2vsuMaS
Java Coursehttp://bit.ly/2GEfQMf
Bash Coursehttp://bit.ly/2DBVF0C
Linux Coursehttp://bit.ly/2IXuil0
C Course http://bit.ly/2GQCiD1
C++ Coursehttp://bit.ly/2V4oEVJ
PHP Coursehttp://bit.ly/2XP71WH
Android Coursehttp://bit.ly/2UHih5H
C# Coursehttp://bit.ly/2Vr7HEl
JavaFx Coursehttp://bit.ly/2XMvZWA
NodeJs Coursehttp://bit.ly/2GPg7gA
Jenkins Course http://bit.ly/2Wd4l4W
Scala Coursehttp://bit.ly/2PysyA4
Bootstrap Coursehttp://bit.ly/2DFQ2yC
MongoDB Coursehttp://bit.ly/2LaCJfP
QT C++ GUI Coursehttp://bit.ly/2vwqHSZ