Hi Antoine,
 
No, your suggestion is incorrect but it was partly my fault. Let's look at the 
brief error message below again before going into detail on where the issue is 
coming from:
........
create_datasource:
[exec] JDBC connection pool EmpServDB_ch3 created successfully.
[exec] Command create-jdbc-connection-pool executed successfully.
[exec] JDBC resource jdbc/EmpServDB_ch3 created successfully.
[exec] Command create-jdbc-resource executed successfully.
 
run_sql:
BUILD FAILED
C:\Temp\ProJPA2\config\common.xml:144: 
java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error 
connecting to server localhost on port 1527 with message Connection refused: 
connect.
 
The problem is that it is referencing the Derby SQL server 
from C:\Temp\ProJPA2\config\common.xml below which I have not included in this 
post earlier:
 <?xml version="1.0" encoding="iso-8859-1"?>
<project name="common">
<property file="common.properties"/>.......<target name="run_sql">
<sql driver="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://${DERBY_HOST}:${DERBY_PORT}/${DB_NAME};create=true"
userid="${DERBY_USER}"
password="${DERBY_PWD}"
src="etc/sql/db.sql"
onerror="continue">
<classpath>
<pathelement path="${DERBY_CLASSPATH}"/>
</classpath>
</sql>
</target>
</project> 
 This "run_sql" target using Derby variable settings in 
C:\Temp\ProJPA2\config\common.properties below to connect to Derby server and 
failed because I have turned it off and turn on MySQL which listens on port 
3306 
instead:
 
##################################################
# Derby Database properties 
##################################################
DERBY_INSTALL=${SERVER_HOME}/javadb
DERBY_PORT=1527
DERBY_HOST=localhost
DERBY_USER=APP
DERBY_PWD=APP
DERBY_SYSTEM_HOME=${EXAMPLES_HOME}/database
DERBY_CLASSPATH=${DERBY_INSTALL}/lib/derby.jar;${DERBY_INSTALL}/lib/derbynet.jar;${DERBY_INSTALL}/lib/derbyclient.jar;${DERBY_INSTALL}/lib/derbytools.jar

The net result is the 
C:\Temp\ProJPA2\examples\Chapter3\16-employeeService\etc\sql\db.sql below get 
run (instead of Chapter2 - does not use GF & is working with MySQL):
 DROP TABLE EMPLOYEE;
CREATE TABLE EMPLOYEE (ID INTEGER NOT NULL, NAME VARCHAR(255), SALARY BIGINT, 
PRIMARY KEY (ID)); 
In addition, the following 
C:\Temp\ProJPA2\examples\Chapter3\16-employeeService\etc\persistence\META-INF\persistence.xml
 that is used by this Glassfish v3 already has some of these MySQL connection 
detail:
 <?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
<persistence-unit name="EmployeeService">
<jta-data-source>jdbc/EmpServDB_ch3</jta-data-source>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" 
value="jdbc:mysql://localhost:3306/EmployeeDB"/>
<property name="javax.persistence.jdbc.password" value="123456"/>
<property name="javax.persistence.jdbc.user" value="applicationuser"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<!-- enable this property to see SQL and other logging -->
<property name="eclipselink.logging.level" value="FINE"/>
</properties>
</persistence-unit>
</persistence> 
Again, the question is how to clear all Derby related 
entries/variables/properties in both C:\Temp\ProJPA2\config\common.xml & 
C:\Temp\ProJPA2\config\common.properties and replace them with the equivalent 
MySQL settings so that Ant (
 
Thanks alot,
Jack<target name="run_sql">) no longer look for port 1527.

----- Original Message ----
From: Antoine Levy-Lambert <anto...@gmx.de>
To: Ant Users List <user@ant.apache.org>
Sent: Fri, 11 February, 2011 1:39:24 AM
Subject: Re: How to switch from Derby to MySQL environment

Hello Jack,

you probably need to start a MySQL server on port 152 ?

Antoine


47.  BUILD FAILED  
48.  
C:\ProJPA2\config\common.xml:144: java.sql.SQLNonTransientConnectionException: 
java.net.ConnectException : Error connecting to server localhost on port 152

On 2/10/2011 7:29 AM, Jack Bush wrote:
> Hi All,
>
> I would like to run a JPA Derby packaged tutorial in MySQL. This 
pre-configured
> exercise runs fine with Derby using Ant built script. However, it would failed
> to build after having attempted to replace the Derby properties with MySQL.
> Below are some configuration files used by this exercise:
>
>
> I am running JDK1.6.0_20, GF3.1, Ant 1.8.2 on Windows XP.
>
> Your suggestion would be much appreciated.
>
> Thanks,
>
> Jack
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to