users@glassfish.java.net

Not Connecting to Database

From: <glassfish_at_javadesktop.org>
Date: Thu, 23 Aug 2007 09:13:21 PDT

When I try and hit my database I get the following exception:

[code]
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No database selectedError Code: 1046
[/code]

It is obvous to me I am not connected to the database. When I go back an look at the log file on the server, I see this:

[code]
[#|2007-08-23T10:04:38.263-0500|CONFIG|sun-appserver-pe9.0|oracle.toplink.essentials.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MyProject/MyEJB_jar/-MyEJBPU.connection|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;DatabaseLogin(
        platform=>MySQL4Platform
        user name=> "my_user"
        connector=>JNDIConnector datasource name=>null
);|connecting|#]

[#|2007-08-23T10:04:38.779-0500|CONFIG|sun-appserver-pe9.0|oracle.toplink.essentials.file:/C:/glassfish/domains/domain1/applications/j2ee-apps/MyProject/MyEJB_jar/-MyEJBPU.connection|_ThreadID=11;_ThreadName=httpWorkerThread-8080-0;jdbc:mysql://:3306/;my_user_at_localhost;MySQL;5.0.45-community-nt;MySQL-AB JDBC Driver;mysql-connector-java-5.0.7 ( $Date: 2007-03-09 22:13:57 +0100 (Fri, 09 Mar 2007) $, $Revision: 6341 $ );
        ;|connected_user_database_driver|#]
[/code]

It is obvious toplink is not able to part the URL path for the database.


When I go back and look at the persistence.xml file I see:

[code]
<properties>
                        <property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/databasename?relaxAutoCommit='true'" />
                        <property name="toplink.jdbc.driver" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
                        <property name="toplink.jdbc.user" value="my_user"/>
                        <property name="toplink.jdbc.password" value="myl_user" />
                        <property name="toplink.target-database" value="MySQL4" />
                        <property name="toplink.target-server" value="SunAS9" />
                        <property name="toplink.logging.level" value="FINEST" />
                        <!--
                                <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
                        -->
                </properties>
[/code]

Looking at the URL for the MySQL database, I used this right out of the book. The only change is the ['] instead of the ["].

Thank you for reading my post!

Russ
[Message sent by forum member 'russ_ray' (russ_ray)]

http://forums.java.net/jive/thread.jspa?messageID=232344