Today my colleague Jason Hinsperger posted a summary of the JDBC URL’s, DLLs, and classnames (along with code samples) for connecting to a SQL Anywhere database via the iAnywhere JDBC driver.
In his post, Jason mentions the availability of a new Type 2 JDBC driver in the SQL Anywhere 11.0.1 release which does not require ODBC to be installed on the machine, significantly simplifying the deployment of JDBC applications on non-Windows platforms with SQL Anywhere and offering a slight performance boost to boot. The option of using this new Type 2 driver (sajdbc.jar) is not reflected in the product documentation, as this driver was made available beginning with Version 11.0.1 builds after 2250.
Jason also mentions that our forthcoming Innsbruck release will offer JDBC 4.0 support, which will eliminate the need to register the driver from within the application.

Glenn Paulley is a Director of Engineering at Sybase iAnywhere.

7 responses so far ↓
1 Volker Barth // Oct 16, 2009 at 5:15 am
Interestingly enough, it seems not even be documented in the EBF release notes (at least not for the 11.0.1.2299 EBF for Win X86) although the sajdbc.jar is there
Regards
Volker
2 David Winkler // Oct 23, 2009 at 6:13 pm
Glenn, I’ve had robust discussions within my development team regarding the benefits of utilizing the iAnywhere driver with our Java app deployed on a Linux platform, but the developers are not keen to using a driver which is not a pure, type 4 driver. Will the JDBC 4.0 driver in SQL Anywhere 12 also be a type 4, pure Java driver, not jConnect (thus not TDS)? The app in question inserts over 40,000,000 rows/day in 5,000 row batches into a SQL Anywhere 11 DB and, in this instance, I enjoy between a 6-8x performance increase (with much less network traffic as well) using the iAnywhere driver. Also, could you please post a walk-through to configuring and using the new sajdbc.jar without having to configure ODBC on a Linux platform?
3 Glenn Paulley // Oct 23, 2009 at 7:02 pm
Hi David, thanks for your question.
The new JDBC driver sajdbc.jar that ships with newer EBFs of Version 11.0.1 – and which will ship as sajdbc4.jar in Version 12, as it offers JDBC 4.0 support – is a Type 2 driver, not a Type 4. I realize that this new driver isn’t the Type 4 driver that some of your development team are asking for, but we think the advantages of the Type 2 driver are considerable, and it’s ease of deployment and JDBC 4.0 support (in Version 12) are quite compelling features over what our existing Type 1 driver supports.
Jason Hinsperger has already posted a summary of the deployment procedure for the new sajdbc.jar driver in existing 11.0.1 installations here. If this is insufficient detail please let me know.
4 Gary Collins // Nov 18, 2009 at 4:21 pm
I just installed SQL Anywhere Developer version 11.0.1 on Windows 7. I had a DB that I had been playing with under version 8 (dbeng.exe). I unloaded it, then reloaded it using the sql script. I then launched the db file using dbsrv.exe. I want to try accessing that DB from another machine on my home network, but
1) it is unclear what files I need to install on the client machine, and
2) it is unclear how I write the connect string to have the software identify the server and connect to the database.
Is there a set of instructions that describe how to install and connect to a SQLAnywhere 11.0.1 server using a Java client on a different machine, including information (detailed) about how to install the appropriate software and specify the connect strings?
Note: The code already works against version 8. I am simply changing the older code to
DriverManager.registerDriver( (Driver)
Class.forName( “sybase.jdbc.sqlanywhere.IDriver” ).newInstance() );
Connection con = DriverManager.getConnection(
“jdbc:sqlanywhere:uid=DBA;pwd=sql;eng=myDB” );
but it is not finding the db server or connecting yet.
I have added sajdbc.jar to my build path, and there is some mention of a .dll that must be in the system path.
I am thinking I just have not gotten the right connect string (getting a can’t find server error), but I want to make sure I understand what it takes to deploy the client.
5 Glenn Paulley // Nov 18, 2009 at 5:41 pm
To use the new Type 2 SQL Anywhere JDBC driver in 11.0.1, then in addition to sajdbc.jar in the client’s classpath, you also need dbjdbc11.dll somewhere, as explained in Jason Hinsperger’s post a few weeks ago.
From the sounds of it, however, you have both pieces in place (so that you can attempt to connect and the connection fails).
Try DBISQL or DBPING with minimal connection parameters and see if it can find your server. If not you may have to supply additional parameters (such as IP address) in order for the connection to succeed.
6 Gary Collins // Nov 19, 2009 at 8:26 pm
Glenn,
Thanks for your response. I finally figured out a connection string that had me connect for a split second. You might want to note that the connection also required a 2nd .dll. Without dblgen11.dll, you get a message “Cannot file language resource file dblgen11.dll” and the connection fails.
Unfortunately, the client connection is terminating abnormally even after I set the Path environment variable to include the directory where those .dlls have been copied. This is the message I am getting on the console:
Connection terminated abnormally; client socket shut down
Disconnected TCPIP client’s AppInfo: IP=192.168.0.3;HOST=LAPTOP;OSUSER=gary;OS=’Windows Vista Build 6002 Service Pack 2′;EXE=’C:\Program Files (x86)\Java\jre1.6.0_07\bin\javaw.exe’;PID=0×1250;THREAD=0×1518;VERSION=11.0.1.2331;API=iAnywhereJDBC;TIMEZONEADJUSTMENT=-360
Is this a known issue?
7 Glenn Paulley // Nov 20, 2009 at 3:59 pm
Not that I know of, no. I use JDK 1.6.0_06, rather than 1.6.0_07. Are any exceptions raised? Can you connect with a different driver (jConnect, or the iAnywhere driver)?
Leave a Comment
Note that all comments are currently being moderated until I have a better handle on spam, so your comment may not appear for a couple of hours