dcsimg
Problem to connect MS sQL server with my programm
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   rania_gferrag
Posted On:   Sunday, May 18, 2003 08:36 AM

Hello, I made this litle programm Just I want to connect to the Data base which is MS SQL server, and I get error when I run the programm Here you have the file : import com.microsoft.jdbc.sqlserver.*; import java.sql.*; import java.io.*; class JDBC_Connect { public static void main(String args[]) { Connection connexion = null; Statement requete = null; ResultSet resultSet; String req1 = "SELECT Name FROM Test"; try { String strClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; St   More>>

Hello,



I made this litle programm Just I want to connect to the Data base which is MS SQL server, and I get error when I run the programm

Here you have the file :



import com.microsoft.jdbc.sqlserver.*;

import java.sql.*;

import java.io.*;



class JDBC_Connect

{

public static void main(String args[])

{

Connection connexion = null;

Statement requete = null;

ResultSet resultSet;


String req1 = "SELECT Name FROM Test";


try

{

String strClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";

String strUrl = "jdbc:microsoft:sqlserver://localhost:1433;"

+ "user=sa; DatabaseName=VJ";

Class.forName(strClassName);

connexion = DriverManager.getConnection(strUrl);



requete = connexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);


resultSet= requete.executeQuery(req1);

while(resultSet.next())

{

System.out.println( resultSet.getString(1));

}



}

catch(ClassNotFoundException e) {

System.err.println("ERREUR : Driver manquant.");

e.printStackTrace();

}

catch(SQLException se) {

System.out.println("ERREUR SQL : !" + se);

}

}

}


and here you have the Error that I get

ERREUR SQL : ! Java.sql.SQLEXception: [Microsoft][SQLServer 2000 Driver for JDBC]

[SQLServer]Invalid object name 'Test'



and Test is the name of the Table


Please If you have an idea about, response my THread, I really need your Help.

Thanks in advance for your answer.

Best regards.


rania +

   <<Less

Re: Problem to connect MS sQL server with my programm

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, May 18, 2003 05:28 PM

[SQLServer]Invalid object name 'Test'


and Test is the name of the Table


Well, it sounds like you and SQL Server have a difference of opinion, on that ...

About | Sitemap | Contact