Reputation: 51
I'm developing an android application. I need connect to sql server. I wrote a code for test connection but i get this error :
java.sql.SQLException: Network error IOException: Permission denied
but i still get the same error. What is my mistake?
My environment:
My Code is:
try
{
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
**Connection conn=DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.1.33:1433/Android_Deneme;instance=CASPER\\MORTY;user=ugur;password=1234");**
String sql="insert into tablo1(ad,yas) values(?,?)";
PreparedStatement prepared = conn.prepareStatement(sql);
prepared.setString(1, "ali");
prepared.setInt(2, 30);
prepared.executeUpdate();
}
catch(Exception e)
{
e.printStackTrace();
}
Upvotes: 3
Views: 12006
Reputation: 9590
You have to add the following permission to your application manifest file.
<manifest>
.....
<uses-permission android:name="android.permission.INTERNET" />
.....
</manifest>
Upvotes: 1