Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql/jsp interaction

Status
Not open for further replies.

a29337t

Programmer
Sep 4, 2001
1
US
I'm having problems with a mysql database - jsp interaction.

HERE'S MY CODE:
System.setProperty("jdbc.drivers","org.gjt.mm.mysql.Driver");

System.out.println("JDBC driver loaded");

String url = "jdbc:mysql://localhost/wls/devportal/ca/jsp/test?user=root&password=temp";

con = DriverManager.getConnection(url);

System.out.println("Database connection established");

HERE'S THE OUTPUT:
JDBC driver loaded
SQLException: Could not connect to database

----------------------
So apparently it is loading the driver, but just can't load the database. Do I have to put the database program (mysql) in a particular folder on my local machine? Is the path specified //localhost/wls/devportal/ca/test the folder which contains the database files? Currently, my database is in my program files folder in windows...

When I load my application using tomcat, the url is:

On my hard drive, this corresponds to:
c:\users\
The mysql database is called test, and the folder containing those files is located on my hard drive:
c:\program files\mysql\data\test
The mysql server is on my hard drive too:
c:\program files\mysql\bin

The mysql driver loads okay, but it can't find the database. Please help!

Thanks,
John

ANY AT ALL HELP IS APPRECIATED!!!
 
I've only used PHP to connect to mySQL, but I have used JSP to connect to DB2. Does mySQL support ODBC connections? I don't think JDBC will work if it doesn't (assuming JDBC just interoperates with ODBC, which I'm not possitive it does). I think mySQL has a separate download to allow ODBC connections. Give that a try.

If you're using Windows you can also try creating a DSN to the database and use JSP to connect to the DSN.

- Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top