aspose file tools
The moose likes JDBC and the fly likes DSN on one terminal and JDBC connection on another terminal, how to connect? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "DSN on one terminal and JDBC connection on another terminal, how to connect?" Watch "DSN on one terminal and JDBC connection on another terminal, how to connect?" New topic
Author

DSN on one terminal and JDBC connection on another terminal, how to connect?

Nitin Jawarkar
Ranch Hand

Joined: Dec 18, 2004
Posts: 79
Hi all,

I m using j2sdk1.4.0._03 for my I/O application, problem is system DSN is on one terminal(system) and JDBC code is on another terminal then how should i write code to connect to database(SQL Server) through JDBC.
current code is look like....

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbcdbc:employee");
System.out.println("Connection Successful.....");
st = con.createStatement();
}
catch(SQLException e)
{
System.out.println(e);
}
}

[edited to disable smilies]
[ December 22, 2004: Message edited by: Jeanne Boyarsky ]

Cheers<br />Nitin
Yu Tao
Greenhorn

Joined: Dec 12, 2004
Posts: 28
use DataSource and lookup is OK!
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I may be wrong, but I don't believe the JDBC-ODBC bridge is network capable. Even if it is, you should get a SQL SErver Type-4 driver and use that instead. Then you just add the machine name, port and dbName in the JDBC URL and everything is sweet.

As an additional pointer, I like to use the SquirrelSQL client to debug JDBC connection settings outside the application so I can just paste them into the application. It's much easier.

You can search Sun's Driver Database for the driver you need.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by David O'Meara:
You can search Sun's Driver Database for the driver you need.


or go to this thread.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: DSN on one terminal and JDBC connection on another terminal, how to connect?
 
Similar Threads
ODBC Remote DSN Connection on AS 400
connectivity between java and ms access
Connection Establishment problem with Oracle
jdbc:odbc with DSN less connection for MS Access
newbie help: Database server