Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Android + JDBC: No route to host SQLException

 
Samantha Rose
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a desktop application (Java/swing/JDBC) to connect to a local database via JDBC. This database is hosted on an IBM i-series (AS400) and is only available on the internal network. I'm working on translating that application into an android app to be used onside in the warehouse via wireless connection.

I have my JDBC connection in it's own thread. The app asks the user for username/password before attempting a connection. The connection fails every time with the same message:

Here is the offending code:

It registers the driver then hits line 6, pauses for a second, then throws an error, completely stalling the device instead of letting my error handler safely close the app.

I have double (triple) checked to ensure the credentials are correctly passed and the IP and schema are both correctly set. This code is a direct copy of my desktop code. The only difference is I use a jar optimized for android instead of the desktop. The jar simply contains a translation layer between native AS400 code and Java, but works the same as any SQL jar.

This is our primary database server used throughout the entire company. It is always available and SQL is enabled on it. I am testing this using a physical android device (not an emulated one) and it is connected to our internal wireless network.

Any suggestions on how to fix this or even a direction to look in? Do I need to do something special for address resolution or something similar? Google-fu is failing me badly. Thanks for your help!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you ping that IP address from the device?
 
Samantha Rose
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was it, actually. For some reason, my test phone decided to junk itself and not tell me it had completely killed the wireless signal. It never really crossed my mind. I'm using my personal phone and it's working well. Now to knock out all the synchronization issues.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic