cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Anywhere 10 JDBC connectivity issue

Former Member
0 Kudos
1,639

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

VolkerBarth
Contributor

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;";