CrazyEngineers Forum

******************************************
Welcome To CrazyEngineers (CE) – an online community of engineers from all over the world! With the younger CEan at 84 and the youngest at 16, CE boasts of professional engineers, students, professors, entrepreneurs, CEOs, geeks & nerds. We exchange innovative ideas, share knowledge, help each other and expand our worldwide network of engineers! You need not have a formal degree in engineering to be a part of CrazyEngineers! Need we say more?
Join CE! | Be a CE Ambassador! | Forgot password? | Sponsor CE | Contact Us
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Reply

  #1 (permalink)
Old 21st April 2008, 03:12 PM
CE - Newbie
 
I'm a Crazy computer science Engineer
Join Date: 19th April 2008
Posts: 5
Send a message via Yahoo to ankititstime
Thumbs down help needed in java coding

can anyone help me in java coding
i am trying to building a frame which will ask 4 username and psw and if they mathches by looking in database ,it will automatically show new frame which shows account info of login user by rerieving info from another table
ankititstime is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)
Old 18th June 2008, 02:45 AM
hbk
CE - Apprentice
 
I'm a Crazy Computers Engineer
Join Date: 12th June 2008
Posts: 36
Default Re: help needed in java coding

u talking abt JDBC??
__________________
2 ways to happines--->

1. Accept what you cannot change
2, Change what you cannot accept
hbk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 18th June 2008, 08:03 AM
CE - Apprentice
 
I'm a Crazy Electrical, Electronics Engineer
Join Date: 14th June 2008
Posts: 22
Default Re: help needed in java coding

You could be more specific, like in which part you need help? Database connectivity or GUI design?
__________________
With complexity comes consciousness
elric is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 19th July 2008, 10:36 AM
CE - Newbie
 
I'm a Crazy Computer Engineer
Join Date: 18th July 2008
Posts: 1
Default Re: help needed in java coding

Hi friend first of all u understand the database connectivity
jaichan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 23rd July 2008, 06:48 PM
CE - Regular Contributor
 
Neha's Avatar
 
I'm a Crazy Computer Science Engineer
Join Date: 14th March 2006
Location: chandigarh
Posts: 474
Send a message via Yahoo to Neha
Default Re: help needed in java coding

hi!
This is all related to database connectivity.
You'll have to maintain a database for the same recording the logins and the passwords etc and connect it to your file.
__________________
Proud to be CEan
Neha is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)
Old 24th July 2008, 06:55 PM
CE - Apprentice
 
I'm a Crazy Computer Engineer
Join Date: 24th July 2008
Posts: 46
Default Re: help needed in java coding

You can follow this step
1. You need to create a table to store this information
2. Learn JDBC its easy ... make the connection.. u will find lots of tutorial on this .
3. Make a simple UI is java swing ....

thats it ... if u need further then reply ... i mean wat kind of problem u r facing ..... paste the error msg here ...(if u have any)
niraj.kumar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)
Old 22nd October 2008, 12:15 AM
CE - Apprentice
 
komputergeek's Avatar
 
I'm a Crazy IT Engineer
Join Date: 21st October 2008
Location: India
Posts: 38
Send a message via Yahoo to komputergeek
Default Re: help needed in java coding

These are two classes from my project:


Code:
Login.java :  

import javax.swing.*; 
import java.awt.event.*; 
import java.sql.*; 
 
public class Login 
{ 
    static JFrame f; 
    static JPanel p1; 
    static JPanel p2; 
    static JPanel p3; 
    static JLabel lUserName; 
    static JTextField tUserName; 
    static JLabel lPassword; 
    static JPasswordField pPassword; 
    static JButton bLogin; 
    static JButton bCancel;    
   
    public static void showLoginWindow () 
    {         
        f = new JFrame ("Login"); 
        p1 = new JPanel (); 
        p2 = new JPanel (); 
        p3 = new JPanel (); 
        lUserName = new JLabel ("User Name : "); 
        tUserName = new JTextField (20); 
        lPassword = new JLabel ("Password  :  "); 
        pPassword = new JPasswordField (20); 
        bLogin = new JButton ("Login"); 
        bLogin.setToolTipText ("Click here to Login"); 
        bLogin.setMnemonic('L'); 
        bLogin.addActionListener (new ActionListener () 
        { 
            public void actionPerformed (ActionEvent e) 
            {                                                  
                try                     
                {                                                                        
                    Connection con = null; 
                    Statement stmt; 
                    ResultSet rs;   
                       boolean flag=false;                                                                            
                    con = DBConnect.getCon ();                          
                    stmt = con.createStatement ();                                                                 
                    rs = stmt.executeQuery ("Select * from USERS  where USERNAME='" + tUserName.getText () + "' and PASSWORD = '" + pPassword.getText() + "'" ); 
                       while(rs.next()) 
                       {                                                 
                           if(rs.getString("USERNAME").equals(tUserName.getText()) &&   rs.getString("PASSWORD").equals(pPassword.getText())) 
                           {                                
                               flag=true; 
                           }                                
                       }  
                       if(flag==false) 
                       {                                         
                           Result_AnalysisFrame frame= new Result_AnalysisFrame();  
                        frame.setVisible(true);   
                        f.hide(); 
                       } 
                       else 
                       { 
                           JOptionPane.showMessageDialog(null,"Login Failed !!!","Login Fail",JOptionPane.WARNING_MESSAGE); 
                       } 
                } 
                catch (Exception ex) 
                { 
                    JOptionPane.showMessageDialog (null, ex, "Error", JOptionPane.INFORMATION_MESSAGE); 
                } 
            } 
        } 
        ); 
        bCancel = new JButton ("Cancel"); 
        bCancel.setToolTipText ("Click here to Exit"); 
        bCancel.setMnemonic('C'); 
        bCancel.addActionListener (new ActionListener () 
        { 
            public void actionPerformed (ActionEvent e) 
            { 
                System.exit (0); 
            } 
        } 
        ); 
        p1.add (lUserName); 
        p1.add (tUserName); 
        p2.add (lPassword); 
        p2.add (pPassword); 
        p3.add (bLogin); 
        p3.add (bCancel); 
 
        Box bx1 = Box.createVerticalBox (); 
        bx1.add (p1); 
        bx1.add (p2); 
        bx1.add (p3); 
 
        f.getContentPane ().add (bx1); 
        f.setVisible (true); 
        f.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); 
        f.setLocation (380, 280);       
        f.pack (); 
        f.setResizable (false);         
    } 
} 
 
 

DBConnect.java :

 
import java.sql.*; 
import oracle.jdbc.*; 
import javax.swing.*; 
 
public class DBConnect 
{ 
 
    public static Connection getCon () 
    { 
        Connection con = null; 
        String url = "jdbc:odbc:RA2"; 
 
        try 
        { 
            Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); 
             
            con = DriverManager.getConnection (url, "RA", "RA"); 
        }                
        catch (Exception e) 
        { 
            JOptionPane.showMessageDialog (null, e, "Error", JOptionPane.INFORMATION_MESSAGE); 
        } 
        return con; 
    } 
}

Last edited by The_Big_K : 22nd October 2008 at 12:38 AM. Reason: Added [code] tag
komputergeek is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)
Old 22nd October 2008, 01:03 PM
CE - Apprentice
 
xero's Avatar
 
I'm a Crazy Computer Science Engineer
Join Date: 13th January 2007
Posts: 44
Default Re: help needed in java coding

the info is not sufficient to rectify. Looking at code(the jdbc ones) it seems more like a driver issue. But before proceeding further, i think you should first go thru the basics of jdbc and the types of drivers available with databases.

I'll just give you intro with the 4 types of drivers ->
1. JDBC ODBC driver - this is the driver you have used in your program. This driver converts the jdbc calls into odbc acting as a bridge. So make sure have configured the odbc correctly. eg if you are using oracle as db so you have to configure the odbc for oracle. (for more reference, google )

2. Native-API partly Java technology-enabled driver - in this the java converts the jdbc calls into db api calls.

3. Net-protocol fully Java technology-enabled driver - in this JDBC API calls is translated into a DBMS-independent net protocol which is then translated to a DBMS protocol by a server

4. Native-protocol fully Java technology-enabled driver - converts JDBC technology calls into the network protocol used by DBMSs directly. This is a pure java based driver !

The above was just informative, don't need to think deep into it. It won't harm to know.

So the take-away is that your code is using the driver of type 1 so first you must check the configuration for Db specific odbc configuration.
__________________
crAzy xerO
xero is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 11:46 PM.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.Ad Management by RedTyger