Jdbc Odbc Driver error -


i have small problem jdbc.odbc.jdbcodbcdriver.

it gives me following error:

java.sql.sqlexception: driver not support function 

the code:

saverec.addactionlistener(new actionlistener() {     @override     public void actionperformed(actionevent e) {         saverecclick = 1;         if (saverecclick == 1) {             try {                 field2.setenabled(false);                 field3.setenabled(false);                 field4.setenabled(false);                 field5.setenabled(false);                 field6.setenabled(false);                 table.setenabled(true);                 mainframe();                  string mydriver = "sun.jdbc.odbc.jdbcodbcdriver";                 string myurl = "jdbc:odbc:dlfishhunter";                 con = drivermanager.getconnection("jdbc:odbc:dlfishhunter");                 stmt = con.createstatement();                  string query = " insert data (user, datum, location, kind, size , bait)" + " values (?, ?, ?, ?, ?, ?)";                 calendar calendar = calendar.getinstance();                 java.sql.date startdate = new java.sql.date(calendar.gettime().gettime());                 preparedstatement preparedstmt = con.preparestatement(query);                 string suser = field0.getselecteditem().tostring();                 preparedstmt.setstring(1, suser);                 preparedstmt.setdate(2, startdate);                 preparedstmt.setstring(3, field3.gettext());                 kinddb = field4.getselecteditem().tostring();                 preparedstmt.setstring(4, kinddb);                 preparedstmt.setstring(5, field5.gettext());                 preparedstmt.setstring(6, field6.gettext());                 frame.dispose();                 preparedstmt.execute();                  try {                     class.forname(mydriver);                 } catch (classnotfoundexception ex) {                     logger.getlogger(dbconnect.class.getname()).log(level.severe, null, ex);                 }                 connection con = (connection) drivermanager.getconnection(myurl, "root", "");             } catch (sqlexception ex) {                 logger.getlogger(dbconnect.class.getname()).log(level.severe, null, ex);             }         }     } }); 

the problem somewhere in code above.

its pretty impossible tell wrong code snippit. few things might want try

1) connection string includes username , password. again, knowing specific db using help. see this link example odbc connection strings.

2) getconnection(myurl, "root", ""), i'm guessing you've setup user root no password. since you're using odbc i'm assuming you're using sql server, comes setup use windows user login, or user called 'sa' - can login via command-line/gui these credentials?


Comments

  1. Rules of the Card Game - Febcasino
    The goal of the game is to score งานออนไลน์ points by winning a card. As you score kadangpintar points by winning, you win. The game 바카라사이트 of the Card Game will be

    ReplyDelete

Post a Comment

Popular posts from this blog

Visual Studio 2015 Update 2 package failed - Blocking setup error 0x80044000 -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -