Showing posts with label everyonei. Show all posts
Showing posts with label everyonei. Show all posts

Wednesday, March 28, 2012

How to connect to sql server2005 from java using JDBC driver

Hi, everyone:
I need to connect my java app to sql server 2005 using JDBC driver, but I don't know how to do.
Thanks for your help.
AdolfoWe currently have a beta2 driver availalbe for this now:

http://www.microsoft.com/sql/downloads/2005/jdbc.mspx

To connect:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection("jdbc:sqlserver://mysqlserver;user=myuser;password=mypassword;databaseName=mydataBase;");

|||

Ok. happen that I have installed the sqlserver 2005 beta 2, using windows authentication, so it needs a name instance to get access. When I use the JDBC driver I can't connect using that name instance.

regards,

Adolfo

|||The beta version of windows authentication has some known issues -- did you try connection to the named instance with SQL Server authentication?

-shelby

How to connect to sql server2005 from java using JDBC driver

Hi, everyone:
I need to connect my java app to sql server 2005 using JDBC driver, but I don't know how to do.
Thanks for your help.
AdolfoWe currently have a beta2 driver availalbe for this now:

http://www.microsoft.com/sql/downloads/2005/jdbc.mspx

To connect:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection("jdbc:sqlserver://mysqlserver;user=myuser;password=mypassword;databaseName=mydataBase;");|||

Ok. happen that I have installed the sqlserver 2005 beta 2, using windows authentication, so it needs a name instance to get access. When I use the JDBC driver I can't connect using that name instance.

regards,

Adolfo

|||The beta version of windows authentication has some known issues -- did you try connection to the named instance with SQL Server authentication?

-shelby

Monday, March 19, 2012

How to configure Report Server in SQL Server 2005?

Hello, everyone:

I hope my question is clear.

I have SQl Server 2005 installed in local computer. I am planning to create report by Report Service so a report server is needed by which I can deploy report from my local computer to that server. How to intall the report server in another computer/

Thanks

ZYTZYT,
Your question is clear, but it doesn't look like you've done any research on the subject. There are plenty of KB articles and technical support documents regarding Reporting Services on the Microsoft website and numerous books exist on the subject.
If you encounter a specific problem when trying to implement Reporting Services having done the necessary research, people are more likely to help you, but they won't generally do all your work for you!

Lempster :S

Monday, March 12, 2012

How to configure a job for maintenance plan?

hello, everyone:
I have a maintenane plan to backup user database daily, How to configure a job to execute this plan daily? Thanks
zytLook up SQLMAINT or XP_SQLMAINT in BOL, depending on whether you want to run the job as OS command or T-SQL, respectively.

Friday, February 24, 2012

How to combine MAx statement with specific search?

Hello everyone!

I've got a table (of "Persons") with 2 columns: "Age" and "Name".
I make a procedure that get the MAX of "Age" of the table, like this:

SELECT
MAX (p.Age) MaxAge
FROM
Persons p

But I'll like to add a new column to my result table. That column corresponds to the "Age" of a person 'X'. 'X' is its 'Name' and i will pass it by parameter to the procedure.
Something like this:

SELECT

MAX (p.Age) MaxAge, --The highest age of the table
p.Age ConcretPersonAge -- The age of the person X

FROM

Persons p

That should returns a single row result table with the max of all 'Age" and the 'Age' of the person 'X'. Anyone can help me to do this?

Thank you to everyon, and a happy new year

Jonathan

You can use a subquery, a derived table or store the result in a variable.

i.e. the sub query one looks like this

select (select max(age) from person) as maxAge, age

from person

where name = @.name

|||

You can use the following query,

SELECT
(Selecct MAX (Age) From Persons) MaxAge, --The highest age of the table
p.Age ConcretPersonAge -- The age of the person X
FROM
Persons P

|||Tahnk you very much. But I think I've simplified too much my query problem. I've got a third column. That its' cities. The original table is actually "Age", "Person","City". I need the maximum age and the age of the person X in each city (multiple rows result table). Could you help me?

Thank you evryone, specially:Mani and Simon.|||

In which case a derived table is the best option

select maxAge.age

, person.age

, city

from (select max(age) age, city from person where name = @.name group by city ) maxage

join person on person.city = maxage.city

where name = @.name

Sunday, February 19, 2012

How to check which tables were called?

Hello everyone:
I have some nightly jobs that execute stored procedure to call the tables? I want to know which table are called by these stored procedures. Is it possible? Any idea will be appreciated.
Thanks
ZYTLemme get this right, you have a series of stored procedures that run every night, but want a list of the affected tables? basically a listing of the tables in those stored procedures run at night?

Basically, in stead of reading through the SP's and noting the tables used, you want an automation process?|||Yes, I need a table list that are affected in the nightly job/|||Just do sp_depends on all of the stored procedures

USE Northwind
GO

CREATE PROC mySproc99
AS
SELECT * FROM Orders
GO

EXEC sp_depends mySproc99
GO

DROP PROC mySproc99
GO|||...although be aware that this will not show tables referenced in dynamic SQL statements embedded in your procedures.|||True..and if the tables was dropped and recreated it won't show as well..

How about adding some triggers