Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27
  1. #21
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,049
    Rep Power
    20

    Default Re: Login from database

    I'll only have a dig if you post here asking what some simple bit of the JDBC is doing...I promise...;)

  2. #22
    _-Blackhawk-_ is offline Member
    Join Date
    Sep 2011
    Posts
    25
    Rep Power
    0

    Default Re: Login from database

    and why not some strainge problem appeard.

    Java Code:
    java.sql.SQLException: ResultSet is from UPDATE. No Data.
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
    	at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7152)
    	at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3867)
    	at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3404)
    	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2385)
    	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
    	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    	at java.sql.DriverManager.getConnection(DriverManager.java:579)
    	at java.sql.DriverManager.getConnection(DriverManager.java:221)
    	at urenreg101.Database.getWerknemer(Database.java:38)
    	at urenreg101.UrenReg101.main(UrenReg101.java:19)
    the part of the code that I expect creates the problem is:
    Java Code:
            try 
            { 
              con = DriverManager.getConnection(url, "borg", ""); 
              Statement select = con.createStatement( );
              Statement datapresent = con.createStatement( );
              ResultSet result = select.executeQuery 
                                  ("SELECT*FROM werknemer");          
              
              System.out.println("Got results:"); 
              while(result.next( )) 
              {
    The strainge thing about it is that without changeing anything the code sometimes gives the error mentiond above but most of the time it works fine and shows al the expected results.
    Last edited by _-Blackhawk-_; 09-21-2011 at 05:12 PM.

  3. #23
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,049
    Rep Power
    20

    Default Re: Login from database

    Something about that connection is playing up:
    at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.ja va:7152)
    at com.mysql.jdbc.ConnectionImpl.loadServerVariables( ConnectionImpl.java:3867)
    It's trying to get the info about the server, but something in there is mucking up occasionally.

    I'd either get a newer MySQL and related driver or, if you already have the newest ones, drop back a point.

    Actually, what MySQL are you using, and what driver? Just wondering if there's a mismatch.

  4. #24
    _-Blackhawk-_ is offline Member
    Join Date
    Sep 2011
    Posts
    25
    Rep Power
    0

    Default Re: Login from database

    MySQL: #define MYSQL_SERVER_VERSION 4.0.0-alpha"(phpdev 4.2.3) (greatly preferd to keep this the same because of project parameters)
    Driver: mysql-connector-java-5.1.17-bin.jar newest version (can be changed easyly)
    Is there a site where I can check if there is a mismatch?

  5. #25
    _-Blackhawk-_ is offline Member
    Join Date
    Sep 2011
    Posts
    25
    Rep Power
    0

    Default Re: Login from database

    Oke thx for the question again installed mysql-connector-java-3.0.17-bin.jar and everything is working fine now!!

    How about your windows 7 stuck problem got passed it already?

  6. #26
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,049
    Rep Power
    20

    Default Re: Login from database

    Yep.
    You were using the connector intended for MySQL 5.
    Top tip for JDBC, try to keep the driver version and database versions the same as there may be changes in protocol between them.

  7. #27
    _-Blackhawk-_ is offline Member
    Join Date
    Sep 2011
    Posts
    25
    Rep Power
    0

    Default Re: Login from database

    Problem is solved.

    Thx again for the help Tolls
    Last edited by _-Blackhawk-_; 09-23-2011 at 08:51 AM.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Database for Login system
    By Chris_X in forum JDBC
    Replies: 1
    Last Post: 11-27-2010, 01:14 AM
  2. Replies: 7
    Last Post: 05-29-2010, 01:57 PM
  3. Replies: 1
    Last Post: 03-15-2010, 01:39 AM
  4. login.jsp
    By roo7 in forum Enterprise JavaBeans (EJB)
    Replies: 5
    Last Post: 12-02-2008, 03:58 PM
  5. Replies: 0
    Last Post: 06-25-2008, 12:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •