run:
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not supported yet.
at app.Login$MySQLConnect.ConnectDb(Login.java:271)
at app.Login$MySQLConnect.access$300(Login.java:268)
at app.Login.jButton1MouseClicked(Login.java:187)
at app.Login.access$200(Login.java:13)
at app.Login$3.mouseClicked(Login.java:113)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.Component.processMouseEvent(Component.java:6528)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4542)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2739)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:719)
at java.awt.EventQueue$4.run(EventQueue.java:717)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD SUCCESSFUL (total time: 8 seconds)
Being Java programmer.
mitchell bat wrote:200 - unreported exception SQLException; must be caught or declared to be thrown
201 - unreported exception SQLException; must be caught or declared to be thrown
mitchell bat wrote:208 - illegal start of type, cannot find symbol, symbol: variable next, location: variable rs of type resultset, illegal start of expression
215 - else without if
219 - catch without try
Being Java programmer.
Being Java programmer.
Always use expressive name for components like jbtnLogin or whichever you feel more expressive, so at first glance you understand what the code does when this button is clicked.
Please read this Java Programming Style
If you are using JDBC API 4.0 or later version and JDK 6 or later, then you don't have to write following code to load the drivers. Because DriverManager class does it when it is loaded. This class has static initializer which loads and registers drivers using ServiceLoader which was introduced in JDK 6
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at app.Login.jButton1MouseClicked(Login.java:194)
at app.Login.access$200(Login.java:13)
at app.Login$3.mouseClicked(Login.java:113)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.Component.processMouseEvent(Component.java:6528)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4542)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2739)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:719)
at java.awt.EventQueue$4.run(EventQueue.java:717)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
BUILD SUCCESSFUL (total time: 5 seconds)
Being Java programmer.
Check what it prints when you click on that JButton.
mitchell bat wrote:Nothing is printed
Being Java programmer.
That means you are trying to solve it, Isn't that best thingmitchell bat wrote:Like I've said I've confused myself and stuck
Being Java programmer.
Ganish Patil wrote:
Before below code on line no 198, write code to call method of MySQLConnect to establish connection. To make sure it is calling correct method.
Just press ctrl and click on ConnectDb(), see where it leads you
I thought better first check whether connection is established or not. Because he/she is using conn which is initialied as null and not calling the method of MySQLConnect which returns an object of Connection to assign to that conn. Do you think we have left setting pst to sth else more?Dave Tolls wrote:That won't cure the null pointer exception.
Still need to actually set pst to something.
Being Java programmer.
Apologize, hassling you more. Sometime it is very difficult for non-native english speakers to understand what some statements in english means. I really have no notion what precisely this statement means.Dave Tolls wrote:is entirely down to 'pst' never being set to anything (let alone a PS using that SQL string)
Being Java programmer.
Opps I didn't even notice that. Thank you so muchDave Tolls wrote:That line should be before any of the calls to setString on 'pst'.
Being Java programmer.
Ganish Patil wrote:
Opps I didn't even notice that. Thank you so muchDave Tolls wrote:That line should be before any of the calls to setString on 'pst'.
have you made changes mentioned above in your code.? Did it print connection established successfully? Also make below change in your code on line no 193 in new updated code.please show what error it gives again.mitchell bat wrote:Guys, i've spent a fair bit of time trying to understand where I went wrong but can't figure it out. Should I scrap the connection and start again?
Being Java programmer.
Yes you are always welcome. Keep tryingmitchell bat wrote:I tried it but still had the same error message, tomorrow when I get a chance i'm going to re do it all and go through my notes again and post my results. I sincerely apologize and hope I won't make the same mistake again, I think I confused myself and jumped the gun when I was writing this up. I did however take a note out of your book and changed the variables names to more meaningful names so it is alot easier to follow.
Being Java programmer.
Being Java programmer.
Since you are struggling,mitchell bat wrote:Can you post your source code?
Being Java programmer.
keep trying until you solve it. We are always there to help as much as we canmitchell bat wrote:This won't be the last you hear from me
Being Java programmer.
Use IDE for design else it will take much time to code it manually.mitchell bat wrote:Something to do with netbeans isn't letting me use the action listener properly so I'll have to do the login from scratch.
Being Java programmer.
yes you need to understand how to use the multiple layouts as appearance varies on different resolutions. I did couple of desktop applications using swing, was very tough to maintain same appearance on all systems.Dave Tolls wrote:It's not a simple tool by any means, and even worse if you don't understand how Swing fits together.
Being Java programmer.