Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
connecting to a database on my c: drive Posted by zeolite on 1 Mar 2005 at 11:32 AM
Hi,
How can I connect to a database that is stored on my local hard drive? I am using the java.sql package as in the following example:

Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection ("jdbc:odbc://localhost/????", username, password);
st = con.createStatement();


What should go where the question marks are (if indeed this is the right approach at all)?
Thanks in advance,
Dan
Report
Re: connecting to a database on my c: drive Posted by arb123 on 2 Mar 2005 at 2:44 AM
I haven't used ODBC in years, so I don't remember the specifics of using the JDBC bridge. As I recall, you need to define your data source in the operating system (via Control Panel).

---------------------------------
HOWTO ask questions: http://catb.org/~esr/faqs/smart-questions.html




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.