Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

Hi everybody, I have developed a java application that requires a connection to DB. The DB that I use is Sybase on iAnywhere. My application runs on a PDA with Windows CE Version 5.00 and Creme Java platform.

When the device remains in standby for a long time (eg. for a night) the connection between the application and the database closes. My problem occurs when the application, once found that the connection is closed, try to create a new one.

When the application tries to create a new connection, iAnywhere starts, but after a few seconds a small window appears with the following error:

    Could not open / read file:

At the same time, the application returns me this exception:

    java.sql.SQLException: JZ006: Caught IOException: Syscall: Unable to Connect
        at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError ()
        at com.sybase.jdbc3.jdbc.ErrorMessage.raiseErrorCheckDead ()
        at com.sybase.jdbc3.tds.Tds.a ()
        at com.sybase.jdbc3.tds.Tds.a ()
        at com.sybase.jdbc3.tds.Tds.login ()
        at com.sybase.jdbc3.jdbc.SybConnection.a ()
        at com.sybase.jdbc3.jdbc.SybConnection.a ()
        at com.sybase.jdbc3.jdbc.SybConnection. <init> ()
        at com.sybase.jdbc3.jdbc.SybConnection. <init> ()
        at com.sybase.jdbc3.jdbc.SybDriver.connect ()
        at it.imolinfo.dao.DBHelper.myGetConnection ()
        at it.imolinfo.dao.DBHelper.myGetConnection ()
        at it.imolinfo.dao.DBHelper.myGetConnection ()
        at it.imolinfo.dao.DBHelper.myGetConnection ()
        at it.imolinfo.dao.DBHelper.myGetConnection ()
        at it.imolinfo.dao.DBHelper.init ()
        at it.imolinfo.dao.DBHelper.checkConnectionStatus ()
        at it.imolinfo.dao.OrdiniDAO.leggiRepartiPerEnte ()
        it.imolinfo.pages.Menu at $ 2.widgetSelected ()
        at org.eclipse.swt.widgets.TypedListener.handleEvent ()
        at org.eclipse.swt.widgets.EventTable.sendEvent ()
        at org.eclipse.swt.widgets.Widget.sendEvent ()
        at org.eclipse.swt.widgets.Display.runDeferredEvents ()
        at org.eclipse.swt.widgets.Display.readAndDispatch ()
        at main.MainMegaController.main ()
        at sun.misc.jar.main ()

Someone can help me on what could be the problem because the connection method that I use to reconnect the application is the same that works perfectly at the first connection?

My method of connection to the DB is as follows:

    String par = " \"" + ConfigurationReader.SYBASE_EXE_PATH + "\" -n " + nameDB +
                 " -x tcpip{PORT="+ ConfigurationReader.SYBASE_PORT +"} -ga " +
                 "\"" + ConfigurationReader.SYBASE_PATH + "\" ";
    Runtime.getRuntime().exec(new String [] {"cmd.exe", "/ C", "start"} + par);

    SybDriver sybDriver = (SybDriver) Class.forName (SYBASE_DRIVER). NewInstance ();


    MainMegaController.conn sybDriver.connect = (URL, SYBASE_PROPERTIES);
    MainMegaController.conn.setAutoCommit (false);

Which file refers iAnywhere when reporting the error "Could not open / read file"?

Thanks in advance for your help.


This question is marked "community wiki".

asked 22 Jun '11, 11:01

Max's gravatar image

accept rate: 0%

edited 15 Mar '13, 18:02

Mark%20Culp's gravatar image

Mark Culp

If you execute that same code each time you connect then I'd say you are trying to start a second server on the same file which won't work because the file is still in use by the first server. Unless you are using autostart, the server doesn't stop just because a connection went away. Instead of starting another server, just reconnect. Alternatively, provide all the necessary information to start the server in you connection parameters and then let the client libraries start the server for you as necessary. In that case, the database & server will go down when the last connection goes away.

permanent link

answered 22 Jun '11, 12:45

John%20Smirnios's gravatar image

John Smirnios
accept rate: 37%

I have to deal with both problems, that is, or should I reconnect to the server if the connection is closed or I have to reboot the server and reconnect at this when the server goes down.
In both cases, my application simply recognizes the connection as closed ... there is a unique way to manage both problems?

(23 Jun '11, 05:02) Max
Replies hidden

As Ian suggested, you could try reconnecting to the server and, if that fails, try starting a new one then connecting to that.

(23 Jun '11, 08:55) John Smirnios

Note that using JConnect on Windows CE is not officially supported. But given that it seems to work for you with your VM, you could try connecting to the running server before exec a new one. Although your existing code may be OK because if you try to start a 2nd server on CE and one is already running, the 2nd server just closes.

Note that John mentions the client library automatically starting and stopping the server. That is not supported by JConnect, and the SQL Anywhere JDBC driver is not supported on Windows CE. So while you could do that from ODBC, OLEDB, ADO.NET or DBLib, you can't do that from JDBC. (Note JConnect is a driver designed for Sybase ASE that works with SQL Anywhere, while the SQL Anywhere JDBC driver is a different JDBC driver only for SQL Anywhere, and generally the SQL Anywhere JDBC driver is recommended - but neither are officially supported on Windows CE).

All that said, I don't have any idea why you are getting the error "Could not open / read file:". If you start a SQL Anywhere Server on a database on your device, then turn off your device and turn it on again, do you get an error?
What version of SQL Anywhere are you running (please include the build number)?

permanent link

answered 22 Jun '11, 13:58

Ian%20McHardy's gravatar image

Ian McHardy
accept rate: 40%

At the first connection I have never encountered any problems!
I use ASA9 (dbsrv9.exe), sorry but I have not found the build number.

(23 Jun '11, 05:06) Max
Replies hidden

FYI: Running "dbsrv9 -v" will tell you the build number

(23 Jun '11, 10:31) Mark Culp
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 22 Jun '11, 11:01

question was seen: 5,303 times

last updated: 15 Mar '13, 18:02