I'll only have a dig if you post here asking what some simple bit of the JDBC is doing...I promise...;)
Printable View
I'll only have a dig if you post here asking what some simple bit of the JDBC is doing...I promise...;)
and why not some strainge problem appeard.
the part of the code that I expect creates the problem is: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 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.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( ))
{
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.
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?
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?
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.
Problem is solved.
Thx again for the help Tolls