Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Try to connect on SQL database jtdb drivers
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Andre St-Onge  
View profile  
 More options Jul 26 2012, 10:23 pm
From: Andre St-Onge <zaramu...@gmail.com>
Date: Thu, 26 Jul 2012 19:23:02 -0700 (PDT)
Local: Thurs, Jul 26 2012 10:23 pm
Subject: Try to connect on SQL database jtdb drivers

I try to connect to my SQL database to do some syncronisation
And I' block on this kind of message
Unable to resolve host name ???

I use Windows seven with SQL Express database
I build a .NET application and I want to syncro address book to my new
Nexus 7 with Jelly Bean android
I use my lan and I can go to web easy, but I can't connect to my SQL
database.

my ManifestAndroid.xml contain this lines

manifest xmlns:android="*http://schemas.android.com/apk/res/android"*<http://schemas.android.com/apk/res/android%22>
 package="com.example.com.andre.repartiteur2"
 android:versionCode="1"
 android:versionName="1.0" >
  <uses-sdk
 android:minSdkVersion="16"
 android:targetSdkVersion="15" />
  <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <application
 android:icon="@drawable/ic_launcher"
 android:label="@string/app_name"
 android:theme="@style/AppTheme" >
 <activity
 android:name=".MainActivity"
 android:label="@string/title_activity_main" >
 <intent-filter>
 <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.LAUNCHER" />
 </intent-filter>
 </activity>
 <activity
 android:name=".OrderScreen"
 android:label="@string/title_activity_order_screen" >
 <meta-data
 android:name="android.support.PARENT_ACTIVITY"
 android:value="com.andre.repartiteur2.MainActivity" />
 </activity>
 </application>
</manifest>

Here is my code I used
and where is Yellow is where I catch the error

public class ClasseSQL {
 String Message = "<p>I'm into my sql class<p>";
 public String getMessage() {
 return this.Message;
 }
 public void setMessage(String value) {
 this.Message = this.Message + "<p>" + value;
 }
 public void dbConnect(String db_connect_string,
 String db_name,
 String db_userid,
 String db_password)
 {
  StrictMode.ThreadPolicy policy = new
StrictMode.ThreadPolicy.Builder().permitAll().build();
 StrictMode.setThreadPolicy(policy);
  Connection conn = null;
 String connectionUrl = null;
  try {
 this.setMessage("loading class jtds...");
  //2012-07-26 use jtds instead of jdbc
 //net.sourceforge.jtds.jdbc.Driver
 //com.microsoft.sqlserver.jdbc.SQLServerDriver
  Class.forName("net.sourceforge.jtds.jdbc.Driver");
  this.setMessage("class jtds loaded ...");
  connectionUrl = "jdbc:jtds:sqlserver://" + db_connect_string + ";" +
 "databaseName=" + db_name + ";user=REPAPP;password=REPAPP;";
  this.setMessage("Open my connection...<p>" + connectionUrl);
 // Establish the connection.
  conn = DriverManager.getConnection(connectionUrl);
 if (conn !=null) {
 Statement statement = conn.createStatement();
 String queryString = "select [UID_Region],[Description] from
[dbo].[Courtage] WHERE [NumeroAvantage] <>''";
 ResultSet rs = statement.executeQuery(queryString);
 while (rs.next()) {
 this.setMessage( rs.getString(1));
 }
 }
 }
 catch (SQLException se) {
 this.setMessage("SQLException : " + se.getMessage() + "<p>" +
se.getCause() + "<p>" + se.getStackTrace() + "<p>");
 }
 catch (ClassNotFoundException e) {
 this.setMessage("Class not found") ;
 }
 catch (Exception se) {
 this.setMessage("Exception error: " + se.toString() + "<p>" +
se.getCause() + "<p>" + se.getStackTrace() + "<p>");
 this.setMessage(connectionUrl);
 }
 }

  Screenshot_2012-07-26-21-58-51.png
84K Download

  Screenshot_2012-07-26.png
196K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nobu Games  
View profile  
 More options Jul 26 2012, 10:57 pm
From: Nobu Games <dev.nobu.ga...@gmail.com>
Date: Thu, 26 Jul 2012 19:57:34 -0700 (PDT)
Local: Thurs, Jul 26 2012 10:57 pm
Subject: Re: Try to connect on SQL database jtdb drivers

Any OS except for Windows uses forward slashes '/' instead of backslashes
for separating path elements. Your screen shot shows something like

<IP ADDRESS>\<XYZ>

Which is probably interpreted as the domain name as a whole and therefore
cannot be resolved. Try using forward slashes instead.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andre St-Onge  
View profile  
 More options Jul 27 2012, 6:42 am
From: Andre St-Onge <zaramu...@gmail.com>
Date: Fri, 27 Jul 2012 03:42:35 -0700 (PDT)
Local: Fri, Jul 27 2012 6:42 am
Subject: Re: Try to connect on SQL database jtdb drivers

The XYZ is the instance of the SQL server not a path
So IPADRESS/instance are not working
Any idea ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andre St-Onge  
View profile  
 More options Jul 27 2012, 9:32 am
From: Andre St-Onge <zaramu...@gmail.com>
Date: Fri, 27 Jul 2012 09:32:05 -0400
Local: Fri, Jul 27 2012 9:32 am
Subject: Re: [android-developers] Re: Try to connect on SQL database jtdb drivers

Hum !!! .. my program working very well on other one SQL Server 2005
except if I tried to connect on my computer on Microsoft SQL Server Express
Edition with Advanced Services
This can be a problem with port lan or restriction on SQL Express
When I will found a way, I will post my solution, just in case !
Thanks

2012/7/27 Andre St-Onge <zaramu...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andre St-Onge  
View profile  
 More options Jul 27 2012, 2:09 pm
From: Andre St-Onge <zaramu...@gmail.com>
Date: Fri, 27 Jul 2012 14:09:00 -0400
Subject: Re: [android-developers] Re: Try to connect on SQL database jtdb drivers

And who need to know how the connection string work for SQLEXPRESS on the
Android

XXX.XXX.XXX.XXX:1434;instance=SQLEXPRESS;databaseName=WorkAdventures;user=* *****;password=******

Replace XXX.XXX.XXX.XXX by computer name or IP Adress and **** by the SQL
user information

and under AndroidManifest.xml

<

manifest xmlns:android=*http://schemas.android.com/apk/res/android*

package=*"com.example.com.andre.repartiteur"*

android:versionCode=*"1" *android:versionName=*"1.0"* >

<uses-sdk android:minSdkVersion=*"16"** *

android:targetSdkVersion=*"15"* />

<uses-permission android:name=*"android.permission.INTERNET"*/>

<uses-permission android:name=*"android.permission.ACCESS_NETWORK_STATE"* />

2012/7/27 Andre St-Onge <zaramu...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »