tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cui Xiaojing-a13339 <a13...@motorola.com>
Subject Need your Direction
Date Tue, 23 Dec 2003 04:14:48 GMT
Hello All,

Now I am trying to access data in a table of a database of a instance of SQL Server 2000 throng
MS JDBC Driver. It is successful by using below code:
 		try {
			Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
			con = DriverManager.getConnection("jdbc:microsoft:sqlserver://MotServer\\InstEm;User=sss;Password=bbb");

	 		stmt=con.createStatement();
		} catch (Exception se) {}
		
		try{
			String sqls="select CID from PayrollData.dbo.CF_payroll_data";
			rs=stmt.executeQuery(sqls);
		}

In the code, PayrollData is a database in instance InstEm. Now I only want to write table
name in SQL statement, not with the database name, then how to write the connection statement?
That means if code write like below, then what is %%%? Thanks.

		try {
			Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
			con = DriverManager.getConnection("jdbc:microsoft:sqlserver://MotServer\\%%%;User=sss;Password=bbb");

	 		stmt=con.createStatement();
		} catch (Exception se) {}
		
		try{
			String sqls="select CID from CF_payroll_data";
			rs=stmt.executeQuery(sqls);
		}

Regards,
Xiaojing


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message