il est devenu:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
static SQLData myReader;
static Connection connection = null;
static Statement stmt = null;
ResultSet rs = null;
static long ConnectServer( String wsLogin, String wsPassword, String wsDatabaseFullPathName) throws SQLException
{
long ErrorCode = 0;
if( ErrorCode == 0)
{
// Provider=SQLNCLI11;User Instance=true;MARS Connection=true;AttachDbFilename=C:\\Programmes\\Microsoft SQLServer\\MSSQL10_50.SQLEXPRESS\\MSSQL\\DATA\\COHERENCE.mdf;Driver={SQL Server Native Client 11.0};Initial Catalog=Northwind
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver" ).newInstance();
String connectionString ="Integrated Security=true;Pooling=true;Max Pool Size=100;Timeout=15;MultipleActiveResultSets=true;Type System Version=SQL Server 2012;database=COHERENCE;server=xantia\\SQLEXPRESS";
connection = DriverManager.getConnection( connectionString);
stmt = connection.createStatement();
Data.m_bServerConnected = true;
}
catch( Exception ex)
{
ex.printStackTrace();
Data.m_bServerConnected = false;
}
}
ErrorCode = 0;
return( ErrorCode);
//OD
} |
La chaine de connexion est validé sur C++;
par contre j'ai des difficultés avec le Class.forName
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
Partager