[Opensource] SQL Server 2000
Ed Lance
edlance1 at cableone.net
Sat Jan 4 19:10:39 PST 2003
Here's one way to do it. I generally use a data source, but one of my
partners had this working and it seems to be fine.
Hope it helps.
private java.sql.Connection dbCon = null;
private String dbURL = "jdbc:microsoft:sqlserver://";
private String serverName = "12.123.123.000"; //your ip address
private String portNumber = "1433";
private String databaseName = "yourdbname";
private String userName = "username";
private String password = "password";
private final String selectMethod = "cursor";
private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private String getConnectionUrl() {
return dbURL
+ serverName
+ ":"
+ portNumber
+ ";databaseName="
+ databaseName
+ ";selectMethod="
+ selectMethod
+ ";";
}
public java.sql.Connection getConnection() {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
dbCon =
java.sql.DriverManager.getConnection(getConnectionUrl(),
userName,password);
if (dbCon != null)
System.out.println("Connection Successful!");
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
}
return dbCon;
}
Ed Lance
208-409-2310
Net Objectives' vision is effective software development without suffering.
Our mission is to assist software development teams in accomplishing this
through a combination of training and mentoring.
-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com]On Behalf Of
nalves at equifax.com.br
Sent: Friday, January 03, 2003 12:18 PM
To: opensource at jcorporate.com
Subject: [Opensource] SQL Server 2000
I'm having troubles to use SQL Server as a database context. First I
created the context as
<context name="sqlserver">
<description>MS SQL Server 2000</description>
<jdbc driver="com.microsoft.jdbc.sqlserver.SQLServerDriver" url
="jdbc:microsoft:sqlserver://SERVER:1433;User=USER;Password=PASSWORD"
connectFormat="1" login="USER" password="PASSWORD" dateSelectFormat
="dd-MM-yyyy" dateUpdateFormat="dd-MM-yyyy" dateTimeSelectFormat
="yyyy-MM-dd" dateTimeUpdateFormat="yyyy-MM-dd" cache="y">
<dbWildcard>%</dbWildcard>
<dbWildcard>*</dbWildcard>
</jdbc>
<type-mapping>
<java-type>LONGVARCHAR</java-type>
<expresso-type>text</expresso-type>
<db-type>text</db-type>
</type-mapping>
<images>%context%/%expresso-dir%/images</images>
<startJobHandler>y</startJobHandler>
<showStackTrace>y</showStackTrace>
<mailDebug>n</mailDebug>
</context>
but I had problems to start expresso. Then I found about the hasSetupTables
option, and I could start Expresso by adding
<hasSetupTables>false</hasSetupTables>
to the context configuration.
Now, when I try to create the tables in this context (Setup -> Create
Database Structure), I get the error
javax.servlet.ServletException: Unable to execute statement: CREATE TABLE
DOWNLOADFILES(FileNumber int identity not null, FilePathName text not null,
DisplayName nvarchar(128), FileURL text, Descrip nvarchar(80) not null,
FileType nvarchar(30), Project nchar(10), GroupName nchar(10) not null,
LastUpdated binary, DLNotes text, MimeNumber int identity not null,
IsActive nchar(1) not null, IsRestricted
bit)(com.jcorporate.expresso.core.dbobj.Schema.createTable(), db/context
'sqlserver'):[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Multiple
identity columns specified for table 'DOWNLOADFILES'. Only one identity
column per table is allowed.
Does anybody know how to set this up correctly? I didn't set up any other
configuration file, I only added the context above to expresso-config.xml.
Thanks
____________________________________________________
Nelio Alves
Equifax do Brasil - System Analyst
+55 -11 3016-6180
nalves at equifax.com.br
*************************************************************
O sigilo desta mensagem é protegido por lei. Se você a recebeu por engano,
queira apagá-la e informar-nos por e-mail endereçado ao remetente.
*************************************************************
The confidentiality of this message is protected by law. If you've received
it in error, please delete it and inform us by e-mail addressed to its
sender.
*************************************************************
_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/
More information about the Opensource
mailing list