Results 1 to 8 of 8
Thread: Driver for Java-SQL
- 07-21-2009, 11:40 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 4
- Rep Power
- 0
Driver for Java-SQL
I am writing a program which writes to and gets information from an SQL database. basically it's a ticket system. A user can create a issue ticket (much like bug tracking) and then using a different client a tech. can retrieve information and add information, all of it being stored in an offsite SQL database.
now when trying to make the connection to the database using the fallowing code
I get a class not found error from theJava Code:public static Connection getConnection() throws Exception{ Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection("jdbc:mysql://*****:3306admin_ticket", "****", "****"); }
<Class.forName("com.mysql.jdbc.Driver");>
line after doing a lot of reading online I ahve found that there is a 'driver' I need to install. however I have read and googled and read and googled everything I can think of but alas I have found no information on where this driver is supposed to be isntalled. is it installed in the server? is it called from the program is it part of the program? Someone please help fill me in.
Thanks in advance
PS incase it's important the server hosting the database is running SQL through phpMyAdmin from within DirectAdmin on top of CentOS. if that makes sense ;) and all of the computers that will be running my program are XP proLast edited by Pr0n; 07-22-2009 at 08:46 AM.
- 07-22-2009, 10:58 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Google for MySQL JDBC driver. You need the right jar file for the version of MySQL you're using. That jar file will need to be added to the classpath for your Java program.
- 07-22-2009, 08:13 PM #3
Member
- Join Date
- Jul 2009
- Posts
- 4
- Rep Power
- 0
I have found the drivers but I haven't been able to find anything that tells me how to add it to the class path (at least that I can understand) can you help me out with that?
-
It somewhat depends on the tools you are currently using. Are you compiling from the command line, or are you using an IDE such as NetBeans or Eclipse?
- 07-23-2009, 12:39 AM #5
Member
- Join Date
- Jul 2009
- Posts
- 4
- Rep Power
- 0
netbeans
netbeans most updated version
and anyone know of another place to get the driver mysql.com is down and has been all day.
[edit]I got the files needed and I'm having trouble figuring out this classpath stuff. I'm running windows XP. how do I get this stupid thing imported
[edit again]
I have messed with this classpath crap for hours no to no avail I feel like I've tried every permutation of setting the classpath in the environment variables but it still can't find it. any ideas?Last edited by Pr0n; 07-23-2009 at 02:45 AM.
- 07-23-2009, 09:14 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
- 07-23-2009, 07:28 PM #7
Member
- Join Date
- Jul 2009
- Posts
- 4
- Rep Power
- 0
wtf
got it! after hours of screwing with it I finally figured it out. with netbeans you have to go to project properties and add it to the compile and run libraries.
That.Was.Ridiculous
yay for 6 hours on one line of code
-
Similar Threads
-
java.sql.SQLException: No suitable driver
By Heather in forum JDBCReplies: 6Last Post: 09-01-2010, 11:29 AM -
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
By ljustiniano in forum New To JavaReplies: 6Last Post: 02-19-2010, 01:57 PM -
java.sql.SQLException: No suitable driver .... when using Custom ClassLoader
By tomer1960 in forum Advanced JavaReplies: 13Last Post: 03-16-2009, 09:37 PM -
how to connect a driver in java for jdbc connections to oracle10g
By swathi palla in forum New To JavaReplies: 4Last Post: 02-04-2009, 03:19 PM -
how to connet to MS SQL in java by using net.sourceforge.jtds.jdbc driver
By cambo in forum JDBCReplies: 0Last Post: 12-18-2007, 06:07 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks