This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes ODBC  & JDBC Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "ODBC  & JDBC Connection" Watch "ODBC  & JDBC Connection" New topic
Author

ODBC & JDBC Connection

nuswolf
Greenhorn

Joined: Jun 05, 2001
Posts: 1
I am using JDBC to connect to ODBC, something like
/*****************************************************
String url = "jdbc dbc:login";
Connection dbconn = DriverManager.getConnection(url,"wolf","");
*******************************************************/
But it has some restriction, both JDBC and ODBC should be in the
same local machine, right? So if the ODBC is installed in another machine, then anyone knows what is the format of the "url".
thanks a lot
kichu kichu
Ranch Hand

Joined: May 10, 2001
Posts: 59
Hai,
As far as i know ,the code given below is the standard way a database connection can be obtained.
Try installing the odbc driver and jdbc driver onto the same machine.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc dbc:"+dsn;
Connection con=DriverManager.getConnection(url,username,password);
return con;

regards,
kichu
[This message has been edited by kichu kichu (edited June 06, 2001).]
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
"nuswolf",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
The type 1 driver, JDBC-ODBC Bridge, translates all JDBC calls into ODBC (Open DataBase Connectivity) calls and sends them to the ODBC driver. As such, the ODBC driver, as well as, in many cases, the client database code, must be present on the client machine.


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: ODBC & JDBC Connection
 
Similar Threads
ODBC - JDBC connection and Updating MY SQL
jdbc -access
Help Please
Establishing Connection to MS Access Databases
JDBC-ODBC Bridge