Hi,
Based on a remark from Juan Lorandi in "RE: Can't find DataSource in
ejb-jar.xml file???" I found out what caused the "SQL Error: Connection is
broken" when I was trying to use SQL-Server.
Although I renamed my Hypersonic data source (by changing the name-tag) in
DATA-SOURCES.XML, it was still trying to use it. Because I wasn't running
HypersonicSQL by that time I got the error message "SQL Error: Connection is
broken".
I thought Orion was using the name-tag in DATA-SOURCES.XML to locate a data
source. But that is not the case. It is using the "ejb-location"-tag. A
reference to this tag is made by the data-source attrib in the tag entity in
orion-ejb-jar.xml file in the deployment directory of the application. This
attribute points to the "ejb-location"-tag in the DATA-SOURCES.XML file. So
although I renamed the Hypersonic datasource, the ejb-location tag was still
the same.
By knowing that is was really easy to solve the problem:
- I just changed the data-source attrib in the tag entity in
orion-ejb-jar.xml to "jdbc/SQLServerDS"
When I started Orion the tables were automatically created on my SQL Server
database.
Marco.
P.s. This is wat I did to use SQLServer with Orion:
- Install the sample applications and deploy them with HypersonicSQL
- Downloaded the trial version of i-net Una 2000 Driver Version 3.04 for MS
SQL Server;
- Put the Una200.jar file in the \ORION\LIB directory;
- Add a new data source to DATA-SOURCES.XML in the \ORION\CONFIG directory
(see below);
- Change the data-source in the ORION-EJB-JAR.XML file in the application
deployment directory to the value of the
ejb-location tag (as found in the DATA-SOURCES.XML, in my case
"jdbc/SQLServerDS")
- Restart Orion
Example of my SQL-Server Datasource:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="SQL-Server"
schema="database-schemas/ms-sql.xml"
location="jdbc/SQLServerCoreDS"
xa-location="jdbc/xa/SQLServerXADS"
ejb-location="jdbc/SQLServerDS"
connection-driver="com.inet.tds.TdsDriver"
username="sa"
password=""
url="jdbc:inetdae://JANSEN001?database=EJBSAMPLES"
inactivity-timeout="30"
/>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: dinsdag 21 november 2000 2:14
To: Orion-Interest
Subject: SQL Error: Connection is broken
Hi,
I am having a problem with connecting the sample applications (e.g. ATM and
Addressbook) to SQL Server . When I deploy the sample applications (e.g.
atm-ejb.jar) I get the following error message: "SQL error: Connection is
broken: Connection refused: no further information".
I did the following things:
- I installed the sample applications and deployed them.
- They work fine with the HypersonicSQL Database.
- I downloaded the trial version of i-net Una 2000 Driver Version 3.04 for
MS SQL Server;
- I put the Una200.jar file in the \ORION\LIB directory;
- I tested the driver with a Java programm found in the README.TXT of the
i-net driver (see below) => works fine!
- I changed the properties of the Hypersonic datasource in DATA-SOURCES.XML
(see below);
- I removed the \ORION\APPLICATION-DEPLOYMENT directory (to make sure that
the sample applications are redeployed);
- I started Orion
Does anybody had the same problems and found a solution? Or does anybody
know if I did something wrong?
Thanks!
Marco.
FYI: I am using Windows 2000 Professional, JDK1.2.2 and SQL-Server 7.0.
Data Source
------------------
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="Hypersonic"
schema="database-schemas/ms-sql.xml"
location="jdbc/SQLServerCoreDS"
xa-location="jdbc/xa/SQLServerXADS"
ejb-location="jdbc/SQLServerDS"
connection-driver="com.inet.tds.TdsDriver"
max-connections="2"
username="sa"
password=""
url="jdbc:inetdae://JANSEN001"
inactivity-timeout="30"
/>
Java Test Program
---------------------------
import java.sql.*; // JDBC package
public class dbtest {
public static void main(String[] args) {
String url = "jdbc:inetdae://JANSEN001";// use your hostname and port
number here
String login = "sa"; // use your login
here
String password = ""; // use your password
here
try {
DriverManager.setLogStream(System.out); // to create
more info
// for
technical support
//load the class with the driver
//Class.forName("com.inet.tds.TdsDriver"); //
JDK,Netscape
//or
Class.forName("com.inet.tds.TdsDriver").newInstance(); //
JDK,Netscape,IE
//or
//new com.inet.tds.TdsDriver(); //
JDK,Netscape,IE
//set a timeout for login and query
DriverManager.setLoginTimeout(10);
//open a connection to the database
Connection connection =
DriverManager.getConnection(url,login,password);
//to get the driver version
DatabaseMetaData conMD = connection.getMetaData();
System.out.println("Driver Name:\t" +
conMD.getDriverName());
System.out.println("Driver Version:\t" +
conMD.getDriverVersion());
//select a database
connection.setCatalog( "master");
//create a statement
Statement st = connection.createStatement();
//execute a query
ResultSet rs = st.executeQuery("SELECT * FROM coffees");
// read the data and put it to the console
while (rs.next()){
for(int j=1; j<=rs.getMetaData().getColumnCount();
j++){
System.out.print( rs.getObject(j)+"\t");
}
System.out.println();
}
//close the objects
st.close();
connection.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}