• Post Reply Bookmark Topic Watch Topic
  • New Topic

[Microsoft Driver] error  RSS feed

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to connect to Microsoft Driver.....

Its giving the error as a cannot find the DNS name even though I connected to Microsoft driver by giving the name as MobileX. Its not connecting.

I loaded the driver by Class.forName("sun.odbc.jdbc.OdbcJdbcDriver");

And While in conn=DriverManger.getConnection("jdbcdbc:MobileX");

Here MobileX is the DNS name.


Its throwing exception as SQLException. I catched But could not find the solution.


thanks in advance


regards
amit bhadre
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what's the message in the exception? Post the full stack trace.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Amit,

do you use
"sun.jdbc.odbc.JdbcOdbcDriver" or do you use
"sun.odbc.jdbc.OdbcJdbcDriver" in your code?

Herman
 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used "sun.jdbc.odbc.JdbcOdbcDriver"

Now I got result as Driver is loaded.

Problem I now getting is Connction con=DriverManager.getConnection("jdbcdbc:MobileX");

In this line connection is not happening to SQL server.I used MobileX as Data Source Name and connecting to MobileX Data Source in sql server.
what is the solution?
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using the jdbc-odbc bridge to connect to SQL Server? Have you considered a proper type-4 driver like Microsoft's own or jTDS?
 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I have'nt used type 4 driver...how to use type 4 driver ot jTDS?

please tell me the solution?


thanks in advance....


regards
amit bhadre
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just download Microsoft's own driver or jTDS's driver and follow the documentation. I only mention it because using the JDBC-ODBC bridge is not recommended where an alternative exists.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!