on 2019 May 21 10:51 PM
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.
Request clarification before answering.
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;";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
47 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.