• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Configuring jdbc connections

 
Tomasz Ducin
Greenhorn
Posts: 10
Hibernate Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone

I'd like to get a better understanding of how JDBC works.

As far as I understood, JDBC is (originally) Sun's interface for connecting dbs. Each implementation is a db driver, such as mysql or derby. JDBC URL is just a pattern, e.g. jdbc:driver://localhost:port/database_name, so it's parametrized.

If I want to connect to a database from any application without an IDE, say a small console application, I need to include a .jar with the driver and configure the connection inside the app (url, user, password, etc.). Is it all I should take care of? I mean - inside the NetBeans IDE there is 'services' tab next to 'projects' and 'files', where I add and remove jdbc connections. Are these just shortcuts to existing database so that I can access them (by clicking) faster or are they some kind of connection objects stored anywhere so that I shall create such objects in my console application?

Please correct me if I misunderstood anything. I'm a newbie, so forgive me silly questions... Thanks in advance!
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Tomasz!

Yes, your understanding is correct. You don't need to set up any connections in the IDE for your program to be able to access the database. All you need is a JDBC driver on the classpath, initialization of the driver in your startup code (prior to JDBC 4.0 driver autoload, that is), and a connection URL.
 
Tomasz Ducin
Greenhorn
Posts: 10
Hibernate Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for your reply. It's easier to get a valuable response here than on stack overflow
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic