Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

unknown database.

843859Sep 24 2006 — edited Sep 24 2006
Hi All

I am getting a wierd error when trying to connect to a mysql database using tomcat.

Created a database called products2006. Made the connection in odbc bridges using mysql driver. Connection works fine. Had to grant all privileges on database in mysql monitor program. Amended java servlet to use mysql driver. Now problem with the connection somehow.

Mysql> GRANT ALL PRIVILEGES ON *.* TO �admin�@�localhost� IDENTIFIED BY �xxxx� WITH GRANT OPTION;

ODBC CONNECTION SET UP IN ADMIN TOOLS � IT IS WORKING (USING MYSQL ODBC 3.51 DRIVER

DOWNLOADED AND COPIED mysql-connector-java-5.0.3-bin.jar TO C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib, C:\JBuilder4\jdk1.3\jre\lib, C:\Sun\AppServer\jdk\jre\lib\ext, C:\Program Files\Java\jdk1.5.0_07\jre\lib\ext

Amended java servlet to use mysql driver:

// Load (and therefore register) the MySQL Driver
Class.forName("com.mysql.jdbc.Driver");

// Get a Connection to the database
con = DriverManager.getConnection("jdbc:mysql://localhost/product", "admin", "xxxx");

Mysqld-nt runs as a service.

I have now invoked mysqld.exe directly from the BIN directory. I am now getting an error message saying : SQLException caught: Unknown database 'product' even though it is in ODBC bridge.

I did grant all privileges on the command prompt again but still same error.


In the ODBC admin tools - the test to the server localhost, to products2006 named product - is successful.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 22 2006
Added on Sep 24 2006
1 comment
253 views