Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

JDBC connection

  Asked By: Seth    Date: Jun 03    Category: Java    Views: 777
  

I need a little help connecting to a database in Java.

The example in the book I have uses the following:

static final String JDBC_DRIVER = "com.ibm.db2j.jdbc.DB2jDriver";
static final String DATABASE_URL = "jdbc:db2j:books";


It goes on to use it:


System.setProperty("db2j.system.home", "C:/mysql");
Class.forName(JDBC_DRIVER);
Connection connect;
connect = DriverManager.getConnection(DATABASE_URL);


First off the book uses a Cloudscape DB, I'm using mysql. My question
is, where does the information for the JDBC_DRIVER and DATABASE_URL
come from? Are the drivers included in the Java software or do I need
to download it?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Louis Mason     Answered On: Jun 03

Have a look at this link. They show you step by step and sample code:

http://dev.mysql.com/doc/connector/j/en/index.html

 
Didn't find what you were looking for? Find more on JDBC connection Or get search suggestion and latest updates.




Tagged: