snajalm
asked on
Trying to make an ODBC connection but no ResultSet gets returned!
I'm trying to make an jdbc-odbc connection like the following. I get connected but my resultset does not get populated. What do you think the problem could be. Here's my code,
String driver = "sun.jdbc.odbc.JdbcOdbcDri ver";
String url = "jdbc:odbc:" + address + ";user=" + username + ";password=" + password;
DriverManager.getDriver(ur l);
Class.forName(driver);
PreparedStatement pStmt = conn.prepareStatement(quer y);
ResultSet rs = pStmt.executeQuery();
String driver = "sun.jdbc.odbc.JdbcOdbcDri
String url = "jdbc:odbc:" + address + ";user=" + username + ";password=" + password;
DriverManager.getDriver(ur
Class.forName(driver);
PreparedStatement pStmt = conn.prepareStatement(quer
ResultSet rs = pStmt.executeQuery();
What is your query ?
ASKER
It is a very long query and I can't post it on here due to security reasons! But do you have any idea of what the situation may be that the server would not return the requested ResultSet despite the fact that the connection is in fact successfully made?!
Maybe query returns nothing?
Does this quesry have no parameters?
If so, why do yiou need to have peraperdStatement?
Try to see what happens with conventional Statement
I'm also usualy claling Class.forName() before Driver.getConnection() though it is probably not important
Does this quesry have no parameters?
If so, why do yiou need to have peraperdStatement?
Try to see what happens with conventional Statement
I'm also usualy claling Class.forName() before Driver.getConnection() though it is probably not important
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There is nothing wrong with the query since it has been used from other applications and is valid in terms of execution and providing a valid result!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well, it ended up to be a silly mistake from my side where I was passing the wrong arguments!