Welcome Guest! To access all forums & features, please register an account or sign-in. → Why register?



java DB connection?


4 replies to this topic - - - - -

#1 SPEhosting

    C++ n00b

  • 2,416 posts
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7, backtrack 5, OSx 10.6

Posted 20 November 2012 - 19:20

hi im trying to make a connection from java program to a mysql database .... how would I do this.... there are a few methods which i have brought up but im not sure which would be the best ?


#2 psyko_x

    Neowinian

  • 727 posts
  • Joined: 13-July 02

Posted 20 November 2012 - 19:25

use spring JDBC. there are many tutorials out there and it's easy to use

here's the official documentation
http://static.spring.../html/jdbc.html

#3 LaP

    Forget about it

  • 3,185 posts
  • Joined: 10-July 06
  • Location: Quebec City, Canada
  • OS: Windows 8 Pro

Posted 20 November 2012 - 19:40

http://dev.mysql.com...ds/connector/j/

http://www.oracle.co...010-090769.html

http://jdbc.postgresql.org/

#4 OP SPEhosting

    C++ n00b

  • 2,416 posts
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7, backtrack 5, OSx 10.6

Posted 20 November 2012 - 22:56

View Postpsyko_x, on 20 November 2012 - 19:25, said:

use spring JDBC. there are many tutorials out there and it's easy to use here's the official documentation http://static.spring.../html/jdbc.html

could you give me a simply walk through on install this on linux xD ? I am doing as it says but when i tried to compile it gave me seval thousand errors all to do with the new package?

#5 kjordan2001

    Mystery Solver

  • 9,842 posts
  • Joined: 27-May 02

Posted 20 November 2012 - 23:38

View PostSPEhosting, on 20 November 2012 - 22:56, said:

could you give me a simply walk through on install this on linux xD ? I am doing as it says but when i tried to compile it gave me seval thousand errors all to do with the new package?
You may want to look into using maven when having to pull in libraries like Spring with multiple dependencies. Here's the dependencies though (in the "This artifact depends on ..." section): http://mvnrepository...c/3.1.2.RELEASE

Even simpler if you don't want to pull in spring to your project is just get the connector/j jar and use Java's built-in JDBC stuff. Spring's straight JDBC stuff doesn't buy you a whole lot except providing some mapping stuff to turn a ResultSet into an object saving you some boilerplate code.