I am running a third party program (let's call it TPP) that uses a SQL Anywhere database for storing data. I have written a Java program that can perform some reporting on the TPP's data by connecting to its proprietary database and running SQL queries. My Java program uses the JDBC/ODBC driver provided by SQL Anywhere to connect to the database. My Java program works great if I start it while running the TPP or the Interactive SQL program that comes with SQL Anywhere 10. If one of these programs is not running and connected to the database then my Java program will bomb out trying to connect. Here is the top of the stack trace:
java.sql.SQLException: [Sybase][ODBC Driver][SQL Anywhere]Database server not found at ianywhere.ml.jdbcodbc.jdbc3.IDriver.makeODBCConnection(Native Method) at ianywhere.ml.jdbcodbc.jdbc3.IDriver.connect(IDriver.java:557) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154)
The SQL Anywhere version being used is 10.0.1 build 4213.
The JDBC/ODBC driver was obtained from here:
C:\Program Files\SQL Anywhere 10\java\jodbc.jar Size: 342318 bytes MD5: 0d358bb2b7178893a1955b0bc594a47f
Here are my JDBC connection parameters:
jdbc.driverClassName=ianywhere.ml.jdbcodbc.jdbc3.IDriver jdbc.url=jdbc:ianywhere:Driver=SQL Anywhere 10;DSN=TPP
Does anyone have a clue what I could be doing wrong? Thanks.
asked 17 Nov '11, 09:15
What are the connection parameters inside the DSN TPP?
It looks like you only give parameters to connect to a running database, which works when other programs have already started the database, whereas it fails when the database is not running.
You might have to specify the START parameter inside your DSN in order to give enough details to start a database engine that loads the required database. If so, you might also set the AUTOSTOP to YES (though that's the default) to close the database automatically.
Note: This does assume that your app and the database are running on the same machine. AFAIK, it's not possible to start a database on a different box automatically during the connection.