I'm trying to connect to SQL Anywhere 10 database from my Java Application with the following code and connection string

URL url = new URL("jar:file:" + "jodbc.jar"+ "!/");
URLClassLoader urlClassLoader = new URLClassLoader(new URL[] {url});
Driver driver = (Driver) Class.forName(driverClass, true, urlClassLoader).newInstance();
DriverManager.registerDriver(new ConnectionDriver(driver));
Connection connection = DriverManager.getConnection(CONNECTION_URL);

Driver = ianywhere.ml.jdbcodbc.jdbc3.IDriver
CONNECTION_URL = "jdbc:ianywhere:driver=SQL Anywhere 10;Host=%s;uid=%s;pwd=%s"

when database is setup locally, the above code snippet is working but when I am trying to connect it to the remote database server with a connection string

"jdbc:ianywhere:driver=SQL Anywhere 10;Host=xxxxxxx;uid=xxxx;pwd=xxxx;DatabaseName=xxxx;";

then while getting connection it waits for it for a infinite time without giving an exception. Connection connection = DriverManager.getConnection(CONNECTION_URL);

could you please let me know if i am missing anything ?

Any help is appreciated.

asked 21 May '19, 21:51

himanshuarora05's gravatar image

accept rate: 0%

The HOST connection paramater was introduced with SQL Anywhere 12. For older versions, you have to use the CommLinks connection parameter with the HOST network protol option, such as

"jdbc:ianywhere:driver=SQL Anywhere 10;Links=tcpip(Host=xxxxxxx);uid=xxxx;pwd=xxxx;DatabaseName=xxxx;";
permanent link

answered 22 May '19, 04:08

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

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](http://url.com/ "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: 21 May '19, 21:51

question was seen: 1,098 times

last updated: 22 May '19, 04:08