unable to load jdbc driver

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

unable to load jdbc driver

Postby media_student » Mon Feb 01, 2010 3:51 pm

Hi,

I want to recieve Datas from a local Database using jdbc.
To test the connection i used the code below.
But i alway recieve "unable to load jdbc driver ".
I`m using the emulator in android and xamp for the Database.


Please help me!!





Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.Tutorial;
  2.  
  3.  
  4.  
  5. import android.app.Activity;
  6.  
  7. import java.sql.*;
  8.  
  9.  
  10.  
  11. import android.os.Bundle;
  12.  
  13. import android.util.Log;
  14.  
  15.  
  16.  
  17. public class Credits extends Activity {
  18.  
  19.        
  20.  
  21.  
  22.  
  23.           public void onCreate(Bundle savedInstanceState) {
  24.  
  25.                 super.onCreate(savedInstanceState);
  26.  
  27.                 setContentView(R.layout.main);
  28.  
  29.                 Connection conn = null;
  30.  
  31.  
  32.  
  33.                    try
  34.  
  35.                    {
  36.  
  37.                             String userName = "root";
  38.  
  39.                         String password = "";
  40.  
  41.                         String url = "jdbc:mysql://localhost/cdcol";
  42.  
  43.                         Class.forName ("com.mysql.jdbc.Driver").newInstance ();
  44.  
  45.                         conn = DriverManager.getConnection (url, userName, password);
  46.  
  47.                         System.out.println ("Database connection established");
  48.  
  49.                      
  50.  
  51.                    }
  52.  
  53.                    catch (Exception e)
  54.  
  55.                    {
  56.  
  57.                        System.err.println ("Cannot connect to database server");
  58.  
  59.                        Log.i("DataLayer", "unable to load jdbc driver");
  60.  
  61.  
  62.  
  63.                    }
  64.  
  65.                    finally
  66.  
  67.                    {
  68.  
  69.                        if (conn != null)
  70.  
  71.                        {
  72.  
  73.                            try
  74.  
  75.                            {
  76.  
  77.                                conn.close ();
  78.  
  79.                                System.out.println ("Database connection terminated");
  80.  
  81.                            }
  82.  
  83.                            catch (Exception e) { /* ignore close errors */ }
  84.  
  85.                        }
  86.  
  87.                    }
  88.  
  89.  
  90.  
  91.             }
  92.  
  93.            
  94.  
  95.            
  96.  
  97.                }
  98.  
  99.            
  100.  
  101.  
Parsed in 0.038 seconds, using GeSHi 1.0.8.4
media_student
Freshman
Freshman
 
Posts: 2
Joined: Mon Feb 01, 2010 12:46 pm
Location: Germany

Top

logfile

Postby media_student » Mon Feb 01, 2010 4:07 pm

02-01 15:08:25.379: WARN/dalvikvm(238): VFY: unable to find class referenced in signature (Ljavax/naming/Reference;)
02-01 15:08:25.389: INFO/dalvikvm(238): Could not find method javax.naming.Reference.get, referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.initializeFrom
02-01 15:08:25.389: WARN/dalvikvm(238): VFY: unable to resolve virtual method 6680: Ljavax/naming/Reference;.get (Ljava/lang/String;)Ljavax/naming/RefAddr;
02-01 15:08:25.389: DEBUG/dalvikvm(238): VFY: replacing opcode 0x6e at 0x0004
02-01 15:08:25.389: DEBUG/dalvikvm(238): Making a copy of Lcom/mysql/jdbc/ConnectionPropertiesImpl$ConnectionProperty;.initializeFrom code (56 bytes)
02-01 15:08:25.399: WARN/dalvikvm(238): VFY: unable to find class referenced in signature (Ljavax/naming/Reference;)
02-01 15:08:25.409: ERROR/dalvikvm(238): Could not find class 'javax.naming.StringRefAddr', referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.storeTo
02-01 15:08:25.409: WARN/dalvikvm(238): VFY: unable to resolve new-instance 466 (Ljavax/naming/StringRefAddr;) in Lcom/mysql/jdbc/ConnectionPropertiesImpl$ConnectionProperty;
02-01 15:08:25.409: DEBUG/dalvikvm(238): VFY: replacing opcode 0x22 at 0x0006
02-01 15:08:25.419: DEBUG/dalvikvm(238): Making a copy of Lcom/mysql/jdbc/ConnectionPropertiesImpl$ConnectionProperty;.storeTo code (72 bytes)
02-01 15:08:25.799: DEBUG/dalvikvm(238): GC freed 4144 objects / 240568 bytes in 75ms
02-01 15:08:25.898: WARN/System.err(238): Cannot connect to database server
02-01 15:08:25.909: INFO/DataLayer(238): unable to load jdbc driver
02-01 15:08:26.219: INFO/ActivityManager(51): Displayed activity com.Tutorial/.Credits: 2608 ms (total 2608 ms)
media_student
Freshman
Freshman
 
Posts: 2
Joined: Mon Feb 01, 2010 12:46 pm
Location: Germany

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests