0
我是新的Android工作室和Java语言,我的意思是,我知道C,C++和C#和Java并不难。但我需要使用另一个人编写的代码。关于安卓工作室SQL查询
我不知道他在作为代码的特定部分尝试。
private java.sql.Connection getConnection()
{
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
if(s.ConfServer_IP.compareTo("Server") == 0)
{
connection = DriverManager.getConnection("jdbc:jtds:sqlserver://"+ s.ConfServer +":"+ s.ConfPuerto +";databaseName="+s.ConfDataBaseName, s.ConfUser, s.ConfPassDB);
}
else
{
connection = DriverManager.getConnection("jdbc:jtds:sqlserver://"+ s.ConfIP +":"+ s.ConfPuerto +";databaseName="+s.ConfDataBaseName, s.ConfUser, s.ConfPassDB);
}
if (connection != null)
System.out.println("Connection Successful!");
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error Trace in getConnection() : "
+ e.getMessage());
publishProgress(6);//Error al conectarse a la base de datos
}
return connection;
}
我想我已经在的Class.forName( “net.sourceforge.jtds.jdbc.Driver”)iusses的newInstance()。
如果有人能帮助我,我将不胜感激。
问候。
感谢您的回复 – user261479