Jump to content



Photo

java DB connection?


  • Please log in to reply
4 replies to this topic

#1 Original Poster

Original Poster

    C++ n00b

  • Tech Issues Solved: 1
  • 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

psyko_x

    Neowinian

  • 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

LaP

    Forget about it

  • Tech Issues Solved: 4
  • Joined: 10-July 06
  • Location: Quebec City, Canada
  • OS: Windows 8.1 Pro Update 1

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 Original Poster

Original Poster

    C++ n00b

  • Tech Issues Solved: 1
  • Joined: 15-July 08
  • Location: my room
  • OS: windows 7, backtrack 5, OSx 10.6

Posted 20 November 2012 - 22:56

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

kjordan2001

    Mystery Solver

  • Tech Issues Solved: 1
  • Joined: 27-May 02

Posted 20 November 2012 - 23:38

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.



Click here to login or here to register to remove this ad, it's free!