|
Hi, everyone, please help me out,
I encountered a strange problem.
When I want to use jdbc-odbc-brider to set up a
database Connection in function init() of a servlet, I get the following
error:
java.sql.SQLException:
[Microsoft][ODBC SQL Server Driver]Client unable to establish
connection
Here is the snip of code:
public void init() throws
ServletException
{ super.init(); String szURL =
"jdbc:odbc:"+"MyDSN";
try { Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); m_con = DriverManager.getConnection (szURL, "sa", ""); } catch (SQLException e) { System.out.println(e.toString()); } catch (java.lang.Exception e) { // Got some other type of exception. Dump it. e.printStackTrace (); } } Thanks in advance.
Jianhong
|
- Re: Cann't set up Connection in init() Jianhong
- Re: Cann't set up Connection in init() Chris Pratt
