"Bad handshake" error with MySQL

Hello,
I'm having problems when I try to connect to DB using MySQL 4.1.1alpha.
I have Conector/J 3.1 and Connector/ODBC 3.51.
The exceptions occur when I try to connect with the sentence:
conection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql?user=root");
the exception thrown is:
Communication link failure: Bad handshake
I can connect from mysql and from mysql Control Center but not from JAVA.
Does Anyone know my problem?
Greetings
Mariano

Did you try this?
conection = DriverManager.getConnection("jdbc:mysql://localhost:3306 /mysql?user=root&password=");
if still doesn't work, recompile the driver and try again. It happened to me once when I downloaded their binary [instead of recompiling their src myself].
hope this helps

Similar Messages

  • ExecuteQuery() error with MySQL

    I have already followed all the steps recommended by OTN to create a connection with MySQL (most up-to-date files) in JDeveloper 10g. It works fine except when I try to find a view and execute a query using an Application Module in a jsp:
    ApplicationModule appMod = appMod.getGenericAppMod();
    ViewObject voTabEmployee = appMod.findViewObject("TabEmployee");
    voTabEmployee.executeQuery();
    It works ok when connected to Oracle DB but it raises the following exception when I move Business Components to a MySQL connection, exactly as recommended:
    java.lang.ClassCastException: com.mysql.jdbc.ServerPreparedStatement
    Any help would be highly appreciated.
    Marcio

    Hi Marcio
    The ApplicationModule that you create in your source (utilApp.java) is created using the default configuration that uses the OracleSQLBuilder as the default SQLBuilder (configured to work with Oracle Databases). Thus, when you use MySQL or any other database (and I confirmed this using SQLServer), a ClassCastException is thrown.
    Instead of using the following lines:
    Context ic = new InitialContext(env);
    String theAMDefName = "mysysjcom.MySysJComModule";
    ApplicationModuleHome home = (ApplicationModuleHome) ic.lookup(theAMDefName);
    ApplicationModule appMod = home.create();
    appMod.getTransaction().connectToDataSource(null, "jdbc/MYSYSJCOMCoreDS", false);
    can you use the following lines:?
    Context ic = new InitialContext(env);
    String theAMDefName = "mysysjcom.MySysJComModule";
    ApplicationModule appMod = Configuration.createRootApplicationModule(theAMDefName, <config_name>);
    ic.lookup(theAMDefName);
    I got your sample working with the above change
    This will ensure that you are using the same configuration that has the SQLBuilder correctly set to your Database type
    Thanks
    Prasanth

  • Communication packets error with MySQL

    Hi,
    I'm having a problem with executing a query on MySQL. It seems that I'm getting the communication packets error once in a while and I'm not sure whether the query is bad or the settings on the database server is bad. Could anyone give me an insight where to look after?
    Thank you,
    852825
    MySQL: 5.1.41-3ubuntu12.7
    JDBC: 5.1.12
    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Got an error writing communication packets
         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:532)
         at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
         at com.mysql.jdbc.Util.getInstance(Util.java:384)
         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2264)

    I've tried the community but no response so far. Any tips on where to look?

  • ExecuteUpdate error with mysql

    Dear All:
    i have a wierd error right here, the code is working correctly for the first call to this jsp page but the error come out when second call to this page. the field was update wrongly, credit=credit-1 become credit=credit-2 and Point=Point+1 become Point=Point+2.
    I am using the mysql and tomcat
    <%
    String a1="update studentdetail Set credit=credit-1 where UserID = '"+UserID+"'";//deduct from student
    a=statement.executeUpdate(a1);
    out.println(a1+" "+a);
    String a2="update teacherinfo Set Point=Point+1 where TeacherID = '"+tID+"'";//add into teacherinfo table
    a=statement.executeUpdate(a2);
    out.println(a2+" "+a);
    String a3="update teachersubcription Set Point=Point+1 where ID = '"+myID+"'";//add into teacher subcription table
    a=statement.executeUpdate(a3);
    out.println(a3+" "+a);
    %>
    please help

    It's hard to tell from the code you provided, but it sounds like a classic case of not reinitializing variables. Depending on where this code lives and how it gets used, you'll update your database with credit-1 and that credit-1 value which now lives in your DB must be finding it's way back into the credit variable. Check everyplace you set that variable and everyplace you read the DB and I'll bet you find your answer.
    Cheers

  • ECM Connector + Turnkey Installation - Error with MySQL (NoClassDefFoundError)

    Twice I have installed LiveCycle ES for JBoss Using Turnkey (following the documentation)... W2K3 Server, 2GB RAM, 32GB Hard Drive, Java 1.5.0.15.
    The core services work good, but it's ECM Connector for Documentum that throws up an error. (Snippets of the server.log below)
    I searched for aspectj.org namespace and it belongs to MySql. Am I supposed to copy a jar file somewhere? I searched the docs but couldn't find any mention.
    Odd enough, the sample ECM Documentum Connector Services work, it's the standard ones that don't (Authentication, Connector, etc)
    EMCDocumentumContentRepositoryConnector: 1.0 Stopped com.adobe.livecycle.ConnectorforEMCDocumentum 8.0.3188.1.83522.8
    When I click start, I get internal error and server.log fills up with the class not found errors.
    Any insight you could provide would great helpful.
    Thanks in advance,
    Vikram
    2008-07-11 11:08:54,984 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error in method: public abstract java.lang.Object com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionCMTAdapterLocal.doRequiresNe w(com.adobe.idp.dsc.transaction.TransactionDefinition,com.adobe.idp.dsc.transaction.Transa ctionCallback) throws com.adobe.idp.dsc.DSCException
    java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
    at com.adobe.livecycle.documentumservice.impl.util.DocumentumUtils.configureClient(Documentu mUtils.java:88)
    at com.adobe.livecycle.documentumservice.impl.DocumentumProviderServiceLifeCycleImpl.configu reDocbroker(DocumentumProviderServiceLifeCycleImpl.java:261)
    at com.adobe.livecycle.documentumservice.impl.DocumentumProviderServiceLifeCycleImpl.execute Once(DocumentumProviderServiceLifeCycleImpl.java:92)
    at com.adobe.livecycle.documentumservice.impl.DocumentumProviderServiceLifeCycleImpl.onStart (DocumentumProviderServiceLifeCycleImpl.java:53)
    at ...
    org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    2008-07-11 11:08:55,000 INFO [STDOUT] Jul 11, 2008 11:08:55 AM com.adobe.idp.dsc.registry.service.impl.ServiceRegistryImpl start
    SEVERE: ServiceRegistryImpl:start(EMCDocumentumAuthProviderService, 1.0):com.adobe.idp.dsc.DSCRuntimeException(Internal error.)
    ALC-DSC-000-000: com.adobe.idp.dsc.DSCRuntimeException: Internal error.
    at com.adobe.idp.dsc.transaction.impl.ejb.EjbTransactionProvider.execute(EjbTransactionProvi der.java:207)
    at com.adobe.idp.dsc.transaction.impl.DefaultTransactionTemplate.execute(DefaultTransactionT emplate.java:79)
    at

    Using j2se 1.4.2_04, turnkey installation works perfectly.
    Bye,
    Dr.Channard

  • Connection error with mysql

    hi,
    i'm using j2sdk1.4.2 and mysql 3.x, and i'm having problems with the connection of these two. i used the latest connector which is mysql-connector-java-3.0.14-production-bin.jar, and i followed all the steps for installing this connector. my classpath is already set to where i placed the jar file. however, i still get this error :
    java.sql.SQLException : unable to connect to any hosts due to exception: java.net.ConnectException : Connection refused : connect
    what should i do?
    and by the way, here's the code :
    import java.sql.*;
    public class JdbcExample1 {
    public static void main(String args[]) {
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection con = DriverManager.getConnection("jdbc:mysql:///");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
         e.printStackTrace();
    } }

    Hi, I am new to all these.
    Recently I been trying to get Mysql and JSP and Tomcat working but try and try still cannot. Since you guys are on this topic and more knowledgeable I hope that you could help me out. Thanks.
    I have the same set up as you except mysql version 4.0
    MySQL is working fine by itself, JSP is working fine connecting to Apache Tomcat fine but cannot get MySQL data connected to show on Tomcat.
    Sample code as below
    import java.sql.*;
    import java.io.*;
    class StocksMy {
    public static void main (String args []) {
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    try {
    } catch (Exception e) {
    System.out.println("StocksMy");
    System.exit(1);
    Connection conn =DriverManager.getConnection
    ("jdbc:mysql://:3306/StocksMy);
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery ("select * from stocks");
    while (rset.next()) {
    String ticker=rset.getString(1).trim();
    String title=rset.getString(2).trim();
    String price=rset.getString(3).trim();
    String blanks=
    System.out.print (ticker);
    System.out.print(blanks.substring(1,8-ticker.length()));
    System.out.print (title);
    System.out.print(blanks.substring(1,41-title.length()));
    System.out.println (price);
    } catch (Exception e) {
    System.out.println("StocksMy: JDBC exception");
    System.exit(1);
    PLEASE is this correct?
    How to get this to show up in Tomcat (localhost:8080) ?
    I guess must convert to JSP first? How? Can show from sample above or a simple sample?
    All very confusing to me.
    Thanks guys.

  • [SOLVED] Error with mysql/perl

    I am horribly ignorant of mysql/perl, I just know they have been working as I have a myth server and all works well, but currently I'm attempting to set up Torrentflux and mythrename.pl, both which give an error that in my eyes appears similar, hopefully someone can sort this out??
    Here is the command that is one step of setting up torrentflux:
    ~ # mysql_setpermission -u root
    Password for user root to connect to MySQL:
    install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10.0 /usr/share/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl /usr/lib/perl5/current /usr/lib/perl5/site_perl/current .) at (eval 9) line 3, <STDIN> line 1.
    Perhaps the DBD::mysql perl module hasn't been fully installed,
    or perhaps the capitalisation of 'mysql' isn't right.
    Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
    at /usr/bin/mysql_setpermission line 71
    ~ #
    And here's trying to run mythrename.pl:
    ~ # /usr/share/mythtv/contrib/mythrename.pl --link /media/mythtv/ --format %T/%T%-%S
    Net::UPnP::ControlPoint is not installed!
    install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10.0 /usr/share/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl /usr/lib/perl5/current /usr/lib/perl5/site_perl/current .) at (eval 13) line 3.
    Perhaps the DBD::mysql perl module hasn't been fully installed,
    or perhaps the capitalisation of 'mysql' isn't right.
    Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
    at /usr/share/perl5/site_perl/5.10.0/MythTV.pm line 337
    ~ #
    EDIT: Okay, I just got help from someone in IRC and it was perl-related. I set up cpan as per the wiki here: http://www.mythtv.org/wiki/index.php/Mythrename.pl. It works great now!
    Last edited by colbert (2008-08-01 21:28:54)

    I am horribly ignorant of mysql/perl, I just know they have been working as I have a myth server and all works well, but currently I'm attempting to set up Torrentflux and mythrename.pl, both which give an error that in my eyes appears similar, hopefully someone can sort this out??
    Here is the command that is one step of setting up torrentflux:
    ~ # mysql_setpermission -u root
    Password for user root to connect to MySQL:
    install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10.0 /usr/share/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl /usr/lib/perl5/current /usr/lib/perl5/site_perl/current .) at (eval 9) line 3, <STDIN> line 1.
    Perhaps the DBD::mysql perl module hasn't been fully installed,
    or perhaps the capitalisation of 'mysql' isn't right.
    Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
    at /usr/bin/mysql_setpermission line 71
    ~ #
    And here's trying to run mythrename.pl:
    ~ # /usr/share/mythtv/contrib/mythrename.pl --link /media/mythtv/ --format %T/%T%-%S
    Net::UPnP::ControlPoint is not installed!
    install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10.0 /usr/share/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl /usr/lib/perl5/current /usr/lib/perl5/site_perl/current .) at (eval 13) line 3.
    Perhaps the DBD::mysql perl module hasn't been fully installed,
    or perhaps the capitalisation of 'mysql' isn't right.
    Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
    at /usr/share/perl5/site_perl/5.10.0/MythTV.pm line 337
    ~ #
    EDIT: Okay, I just got help from someone in IRC and it was perl-related. I set up cpan as per the wiki here: http://www.mythtv.org/wiki/index.php/Mythrename.pl. It works great now!
    Last edited by colbert (2008-08-01 21:28:54)

  • "Bad request" errors in Firefox with second user account

    Yesterday, I set up a second user account for my husband to use. Everything seems to work fine with one annoying exception. When Firefox 3 is used as the browser under the new user account, I get frequent "Bad Request" errors with various web mail programs (MobileMe, GMail, Earthlink's web mail).
    This does not happen when the same Firefox 3 is used under my original user account. It also does not happen when performing the same functions with Safari under the new user account. It also doesn't seem to matter whether Fast User Switching is enabled or disabled.
    I have tried clearing caches, deleting cookies, deleting preferences etc. in the second user's Firefox, all to no avail. Anyone have any other ideas?
    I guess one thing I'm a little unclear about... is the second user actually using the same Firefox app as the first user? If so, would there be a way to install a 2nd Firefox app that would only be for the second user? I'm just thinking maybe there is some kind of conflict going on?
    Any thoughts or help out there much appreciated!

    I think I figured it out. I found an article online that said if you have Parental Controls enabled on an account (which I did on the second user account), it will not allow Firefox to write cookies, thus causing the "bad request" errors.
    This is not exactly true, as Firefox under the new user DID seem to be writing cookies just fine. However, when I disabled Parental Controls on the account, suddenly the errors went away. So, it doesn't have to do with cookies, but there is something about having Parental Controls turned on that can cause these errors.

  • MySQL syntax error with TestStand 4.0 database logging

    I had been using MS Access database to log results which worked fine but the access database is too limited. Switched to MySql. Database works fine and I can query it from Visual C++ and was able to create all my result tables fine from TestStand.
    I get a syntax error when actually trying to log results and it has to do with either a missing quote or and extra quote, I can't quite tell. I thought I saw a post on this somewhere but can't find it now. Here is the complaint from TestStand:
    An error occurred calling 'LogOneResult' in 'ITSDBLog' of 'zNI TestStand Database Logging'
    An error occurred executing a statement.
    Statement: UUT_RESULT.
    [MySQL][ODBC 3.51 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT VALUES' at line 1
    Description: [MySQL][ODBC 3.51 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT VALUES' at line 1
    Number: -2147467259
    NativeError: 1064
    SQLState: 37000
    Reported by: Microsoft OLE DB Provider for ODBC Drivers
    Description: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
    Number: -2147217887
    NativeError: 0
    SQLState: 37000
    Reported by: Microsoft OLE DB Provider for ODBC Drivers
    Source: TSDBLog
    And here is all that appears in the MySql logfile:
    INSERT INTO UUT_RESULT DEFAULT VALUES
    070914
    You can't see it here but the string is truncated after the word VALUES. The next line starts with the odd number.
    Any ideas?
    Thanks,
    Bill Peters
    BAE SYSTEMS

    Sure. There were two bugs in the ini file that contains the default TS schemas (I think it was Default_Database_Options.ini or like that...).
    Anyway the table description for STEP_NUMERICLIMIT had for it's command line INSERT INTO MEAS_NUMERICLIMIT. I guess TestStand looked at that and said hmm I better create that table too. Then later down the page when you try to create MEAS_NUMERICLIMIT it says the table already exists even though it is empty. The generate SQL button builds a bad file and then the database viewer creates a bad database. I would have to go into MySql and drop the database. I had to save the schema under a custom name, edit it read it back in, generate a new SQL file, but then it would still fail validation because the ini files don't get updated until you exit TestStand. So basically I did this process 3 times before I got it right.
    It's wasn't a big deal but it's amazing how a little thing can cause a lot of work.
    The second bug, I'm not certain was initially in the file or somehow got set on the fly. There was a random int statement at the very end of the SQL table description for UUT_RESULT. It was also in the schema INI file. Since the int had no name and occurred in a odd place, it created a syntax error in MySql. Same fix as above.
    But like I said it's working great now. I like this approach because I serve it to the net with Apache and parse the database with simple PHP scripts.
    Thanks,
    Bill Peters
    BAE SYSTEMS

  • SSPI handshake error in SQL Server 2008 with SharePoint 2010

    Hi,
    I am having some trouble with my SharePoint database server this time. SharePoint Server 2010 is running on Windows Server 2008 R2 and SQL Server 2008 is running on Windows Server 2008 R2 as SharePoint database also. SharePoint users are authenticated through
    Active Directory. I am getting the following error almost everyday in SQL Server-
    SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. 
    [CLIENT: (Server IP Address)].
    Could somebody help me to resolve this error?
    Thanks in advance.

    Hi pointtoshare,
    No, a Service Principal Name (SPN) must be registered with Active Directory to use Kerberos authentication with SQL Server and not need to use NTLM authentication.
    Could you run the following query on your SharePoint Server and check the value of the auth_scheme column?
    SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@spid ;
    Edit:The
    query above should run on the SharePoint machine with using SQL Management Studio.
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has be

    Hello, I have a sql 2005 server, and I am a developer, with the database on my own machine.  It alwayws works for me but after some minutes the other developer cant work in the application
    He got this error
    Login failed for user ''. The user is not associated with a trusted SQL Server connection. [CLIENT: 192.168.1.140]
    and When I see the log event after that error, it comes with another error.
    SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: 192.168.1.140]
    He has IIS5 and me too.
    I created a user on the domain called ASPSYS with password, then in the IIS on anonymous authentication I put that user with that password, and it works, on both machines.
    and in the connection string I have.
    <add key="sqlconn" value="Data Source=ESTACION15;Initial Catalog=GescomDefinitiva;Integrated Security=SSPI; Trusted_Connection=true"/>
    I go to the profiler, and I see that when he browses a page, the database is accesed with user ASPSYS, but when I browse a page, the database is accesed with user SE\levalencia.
    Thats strange.
    The only way that the other developer can work again on the project is to restart the whole machine. He has windows xp profession, I have windows 2000.
    If you want me to send logs please tellme

    Well here's my problem, maybe you can help. Intermittenly I get a login failed when connecting to a db engine through Server Management Studio using Windows authentication. When this happens the following entries are generated on the server's application event log:
    Event Type:        Error
    Event Source:    MSSQLSERVER
    Event Category:                (4)
    Event ID:              17806
    Date:                     1/14/2009
    Time:                     10:41:31 AM
    User:                     N/A
    Computer:          <server name>
    Description:
    SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security; the connection has been closed. [CLIENT: <ip address>]
    Event Type:        Failure Audit
    Event Source:    MSSQLSERVER
    Event Category:                (4)
    Event ID:              18452
    Date:                     1/14/2009
    Time:                     10:41:31 AM
    User:                     N/A
    Computer:          <server name>
    Description:
    Login failed for user ''. The user is not associated with a trusted SQL Server connection. [CLIENT: <ip address>]
    I've already ensured that the server is set to mixed authentication mode. Oddly enough, the workaround that I've found is that if I remote desktop into the server, log in and then log back out, Management Studio is suddenly able to connect again. No idea why it works. 
    As I said before, it is intermitten. Some days it errors on login, other days it doesn't and there are no configuration changes between them. Also, both client and server are in the same domain and same site so there is no VPN or anything in between. I'm really quite stumped. Any help would be great, or if you can point me in the right direction of where to look. Thank you in advance!

  • Windows bad image in Vista playing wmv file error with Acro8professional

    I have created a multimedia file with movieclips and audio. The file plays perfectly on XP2 and XP3 machines. However I have one Vista machine which reports a bad image error when clicking the play button for the movie. This error will display after three attempts after which the file will play without problem. The file embedded in Acrobat 8 is a WMV file.
    The error message is as follows: Exception processing image
    0xc000007b parameters 0x75AD023C 0x75AD023C 0x75AD023C 0x75AD023C
    The vista laptop is the one we use to demo files so it would be great to establish what the problem is. Do not have access to another vista machine to compare.
    Many thanks

    i had a similar issue. don't know what was the reason but the latest update fixed it.

  • Reconnect policy with MySQL failing because of autoCommit error

    This related to this issue, but I didn't see any responses to it: Reconnecting a dead connection from a UnitOfWork commit - Autocommit error
    I'm testing with MySQL 4.1 and I have a reconnect policy that does the following (I believe this is a pretty standard approach):
    session.setExceptionHandler( new ExceptionHandler() {
    public Object handleException(RuntimeException exception) {
         if (exception instanceof DatabaseException) {          
    dbex.getAccessor().reestablishConnection(dbex.getSession());
    However, when it reestablishes the connection (and I have traced this and can verify that this code is executing and a reconnect is performed), I get the following error for any updates:
    Internal Exception: java.sql.SQLException: Can't call rollback when autocommit=trueError Code: 0
    at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:277)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicRollbackTransaction(DatabaseAccessor.java:1090)
    at oracle.toplink.internal.databaseaccess.DatasourceAccessor.rollbackTransaction(DatasourceAccessor.java:486)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.rollbackTransaction(DatabaseAccessor.java:1075)
    at oracle.toplink.publicinterface.Session.basicRollbackTransaction(Session.java:377)
    I only have this problem with the MySQL JDBC drivers. I can continue to read normally, but I can't perform any transactions.
    This isn't so much of a question about MySQL specifically, but rather a question about how reestablishConnection() connects to the database differently from my initial login using DatabaseLogin. Obviously, I don't have this error connecting normally. I only get it after a reconnect is applied.
    Specific questions are: Is there another handler I can add to ensure JDBC Connections returned by ServerSession are always setAutoCommit(false)? Am I reestablishing the JDBC connections incorrectly?
    Nate

    Nate,
    This does appear to be MySQL JDBC specific but is most likely related to a general issue.
    When the connection drops and you receive the notification through the exception handler I would typically recommend looking at the session in us (isUnitOfWork) or the query type (isWriteObjectQuery) to see if the operation that failed was involved in a transaction (UnitOfWork commit).
    In these transaction cases you need to do more then just re-connect and retry. You need to ensure after reconnection that an application exception is raised so the UnitOfWork operation(s) can be retried completely. I would simply add to this case to ensure that the JDBC connection is put back in a state where it can be managed properly.
    There is no special operation or any case I know of where any special auto-commit needs to be set on a connection after it has dropped and before it is re-connected.
    Doug

  • SSPI handshake failed with error code 0x8009030c and Login failed for user''

    I got the following error when tried to connect to local machine in the
    non-domain environment with Windows Authentication by SSMS.
    "SSPI handshake failed with error code 0x8009030c while establishing a connection with integrated security."
    "Login failed for user''. the user is nothing associated with a trusted SQL server connection."
    questions
    1,if I saw the "SSPI handshake failed ", does it means it must used Kerberos but failed? or it is also possible used the NTLM but failed?
    2,Any ideas for this issue?
    Please click the Mark as Answer button if a post solves your problem!

    Hi Michael,
    Firstly, "SSPI Handshake Failed" error happens usually when connection failed between the server and domain controllers or failed Kerberos authentication. For more details about "SSPI Handshake Failed" error, please review this
    FAQ.
    Secondly, regarding to your error message, it could be caused by loopback check. To resolve the issue, please set the DisableLoopbackCheck registry entry to 1 by performing the following steps.
    1.Click Start, click Run, type regedit, and then click OK.
    2.Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
    3.Right-click Lsa, point to New, and then click DWORD Value.
    4.Type DisableLoopbackCheck, and then press ENTER.
    5.Right-click DisableLoopbackCheck, and then click Modify.
    6.In the Value data box, type 1, and then click OK.
    7.Exit Registry Editor.
    8.Restart the computer.
    There is a similar blog about your scenario for your reference.
    http://www.bhcblog.com/2009/10/08/fix-for-login-failed-for-user-the-user-is-not-associated-with-a-trusted-sql-server-connection/
    Thanks,
    Lydia Zhang
    If you have any feedback on our support, please click
    here.
    Lydia Zhang
    TechNet Community Support

  • [ForumFAQ]How to troubleshoot error "SSPI handshake failed with error code 0x80090324"

    Understanding the problem:
    When connect to SQL Server with Windows authentication, you may receive the following message in the SQL Server error log:
    SSPI handshake failed with error code 0x80090324, state 14 while establishing a connection with integrated security; the connection has been closed.
    Security Support Provider Interface (SSPI) is a set of Windows APIs that allows for delegation and mutual authentication over any generic data transport layer, such as TCP/IP sockets. SQL Server supports Kerberos indirectly through the Windows Security Support
    Provider Interface (SSPI) when SQL Server is using Windows Authentication.
    "SSPI Handshake Failed" error happens usually when connection failed between the server and domain controllers or failed Kerberos Authentication. There are many reason for SSPI Handshake error to appear in SQL Server error log.
    Troubleshot the problem:
    Download and install the Windows error code lookup tool Err.exe to view error descriptions for Windows Error Codes.
    The error code 0x80090324 (SEC_E_TIME_SKEW) means "clock on client and server machines are skewed". In most case, this is a Kerberos issue. Kerberos is using a timestamp to protect against replay attacks. The maximum time skew that can be tolerated
    between a ticket's timestamp and the current time at the KDC is 5 minutes by default.
    Also check the Windows Event Log of client machine, domain controller and the SQL Server machine for existence of W32time error messages.
    The solution:
    Make sure the clock of client server, domain controller and the server running SQL Server are within five minutes of each other. Or Resynchronize the clock by run w32tm /resync on client machine and SQL Server machine.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    This error can happen due to Active Directory configuration issue or Network related issues. Assuming they are fine,
    another reason could be related to fail Kerberos Authentication to connect to SQL Server.
    In Windows 2003 and above, the default method of establishing a connection is Kerberos but if it fails, then connection may be established using NTLM. An error may be registered on SQL Server error log due to Kerberos failure.
    To confirm if you have any database connection using Kerberos authentication, run this on your SQL Server
    SELECT distinct auth_scheme FROM sys.dm_exec_connections
    If you only see NTLM and SQL then, there is no Kerberos connection.
    To use Kerberos, the client and SQL Server must be in the same domain or trusted domains and a Service Principal Name (SPN) must be registered with Active Directory for SQL Server service account.
    You can check if the service account already has SPN, by running this on the SQL Server
    setspn -l <domain\sqlserviceaccount>
    If you don't see anything starting with MSSQLSvc\ then the account is not setup with SPN.
    You can manually register SPN as a Domain Administrator using these commands.
    To      create an SPN for the NetBIOS name of the SQL Server use the following      command:
    setspn –A MSSQLSvc/<SQL Server computer name>:1433      <Domain\Account>
    To      create an SPN for the FQDN of the SQL Server use the following command:
    setspn      -A MSSQLSvc/<SQL Server FQDN>:1433 <Domain\Account>
    If SQL Server service account is granted "Validated write to service principal name" privilege in Active Directory, SQL Server database engine will register itself when it starts and unregisters at shutdown. If you Domain Administrators do not permit this setting
    then you should manually register the SPN and the SSPI error will go away.
    Also the SQL Server service account must be granted "Account is trusted for delegation" privilege in Active Directory. If your SQL Server connects to other SQL Server using Linked Server then the server must also be granted "Trust this computer for delegation
    to any service" privilege.
    For a named instance, you can use the FQDN of the named instance instead of SQL Server FQDN and use the port number.
    For a clustered server, you should use the FQDN of the SQL Server virtual name. In this case you will need two entries, one with port name and one without such as
    setspn -A MSSQLSvc/<Virtual SQL Server FQDN> <Domain\Account>
    setspn -A MSSQLSvc/<Virtual SQL Server FQDN>:1433 <Domain\Account>
    Kerberos authentication works when SQL Server, Service Account and Windows account accessing the SQL Server are in same windows domain. If anyone these are in different domain, there must be bidirectional trust established between the domains, otherwise it
    does not work.

Maybe you are looking for

  • Is there a way to make all page margins the same?

    I've exported a book file from indesign. Since the pages were in a book-type spread, the odd and even pages have different margins. The odd page has the bigger margin on the left, while the even has the bigger margin on the right.  Is there any way t

  • 8i Install on Pentium 4

    Anyone know of a fix to the Oracle 8i install problem on Pentium 4 machines?

  • Reverse feature of "Go to Bookmark"

    Hello, In Adobe Reader 9, is there a feature so that from any displayed document page the corresponding bookmark can automatically be found and displayed? As an example of the need for that feature, I have a 3500-page PDF in which each page is bookma

  • Ok, I've never had to do this before...

    I have an MP3 that has 2- sec silence at the beginning that i need to get rid of Please anyone with suggestions i'd gladly appreciate it. Ive tried quicktime pro, and it wont save it. Does anyone know of any programs that I can use to trim the beginn

  • Attempting to launch a help browser from a java application

    I am currently investigating being able to view help html files through launching a browser from my Java application. I have come across the java.lang.Runtime and java.lang.Process classes which allow me to launch a browser like Netscape or Explorer