I am in accordance with the method of online direct sqlserve
1. In the AndroidManifest. Joined the socket in the XML file permissions
2. I am in libs directory to place: JTDS - 1.2.7. Jar and SQLJDBC jar, and in the project Structure of App
Dependencies added JTDS - 1.2.7. Jar and SQLJDBC jar
3. Connect the SQL code is:
Public DBUtil () {
}
Private static Connection getSQLConnection ()
{
String driverName="net. Sourceforge. JTDS. JDBC. The Driver".//load the JDBC driver
//JDBC: Microsoft: used to
String dbURL="JDBC: JTDS: essentially://IP: 1433/database name; Charset=utf8 ";//connect to the server and the database sample
String userName="sa";//the default user name a
String userPwd="password";//password
The Connection conn=null;
Try
{
Class.forname (driverName);
//each run to the conn code below will flash back? Could you tell me how to solve a great god? Thank you,
Conn=DriverManager. GetConnection (dbURL, userName, userPwd);
System. Out.println (" Connection Successful!" ); The Connection Successful!
} the catch (a ClassNotFoundException e)
{
e.printStackTrace();
} the catch (SQLException e)
{
e.printStackTrace();
}
Return the conn.
}
I don't have many points, please help solve the great god,
CodePudding user response:
What's wrong, the error log stick outCodePudding user response:
No prompt error message, will jump to the stars. This code under the JavaIf (slowDispatchThresholdMs & gt; 0 {
The final long time=end - start;
If (time & gt; SlowDispatchThresholdMs) {
Slog. W (TAG, "Dispatch took" + time + "ms on
"+ Thread. CurrentThread (). The getName () + ", h="+
MSG. Target + "cb=" + MSG. The callback + "MSG=" + MSG. What);
}
}
CodePudding user response:
1. The breakpoint debugging2. Why do you want to direct the database
CodePudding user response:
Tip: Java. Lang. RuntimeException: No message resource found for message property prop. ServertypeCodePudding user response:
Microsoft:
JDBC: essentially://{host: ssrp_host: localhost} [\ \ {instance: ssrp_instance}] [: {port: ssrp_port}] [; & lt;;, user={user: param} [Name], password={password: param}, the database [Name]={database}, {: identifier}={: param} & gt;] ;
JTds:
JDBC: JTDS: essentially://{host: ssrp_host: localhost} [: {port: ssrp_port}] [/{database}] [; & lt;;, the instance={instance: ssrp_instance}, user={user: param}, password={password: param}, {: identifier}={: param} & gt;]
Behold stitching is wrong