Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 578271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:14:32+00:00 2026-05-13T14:14:32+00:00

I’m having trouble doing anything with clojure.contrib.sql beyond establishing a connection. I have a

  • 0

I’m having trouble doing anything with clojure.contrib.sql beyond establishing a connection.

I have a mysqld running on localhost:3306 with a database called clj_db.
The user ‘clj_user’@’localhost’ with password ‘clj_pass’ can access this database.

When trying to “select * from clj_table” I get a “com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘????????????????’ at line 1”.

What am I doing wrong?

clj_db.clj_table

CREATE TABLE `clj_table` (
  `col_one` int(11) NOT NULL,
  `col_two` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

mysql_test.clj

(ns test.mysql
    (:use clojure.contrib.sql)
)

(def db-settings
    {:classname "com.mysql.jdbc.Driver"
    :subprotocol "mysql"
    :subname "//localhost:3306/clj_db"
    :user "clj_user"
    :password "clj_pass"})

(with-connection db-settings
    (with-query-results rs ["select * from clj_table"]
        (dorun (map #(println (:col_one :col_two %)) rs))
    ))

Output

Exception in thread "main" com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1 (mysql_test.clj:0)
   at clojure.lang.Compiler.eval(Compiler.java:4658)
   at clojure.lang.Compiler.load(Compiler.java:4972)
   at clojure.lang.Compiler.loadFile(Compiler.java:4939)
   at clojure.main$load_script__7405.invoke(main.clj:213)
   at clojure.main$script_opt__7442.invoke(main.clj:265)
   at clojure.main$main__7466.doInvoke(main.clj:346)
   at clojure.lang.RestFn.invoke(RestFn.java:441)
   at clojure.lang.Var.invoke(Var.java:367)
   at clojure.lang.AFn.applyToHelper(AFn.java:179)
   at clojure.lang.Var.applyTo(Var.java:476)
   at clojure.main.main(main.java:37)
Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1048)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
   at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687)
   at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionImpl.java:1859)
   at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3593)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2199)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:784)
   at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:350)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:284)
   at java.sql.DriverManager.getConnection(libgcj.so.10)
   at clojure.contrib.sql.internal$get_connection__218.invoke(internal.clj:85)
   at clojure.contrib.sql.internal$with_connection_STAR___226.invoke(internal.clj:102)
   at test.mysql$eval__386.invoke(mysql_test.clj:12)
   at clojure.lang.Compiler.eval(Compiler.java:4642)
   ...10 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:14:33+00:00Added an answer on May 13, 2026 at 2:14 pm

    I’ve switched to Sun’s JDK6 instead of GIJ.

    I got “com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure”.
    I found this thread, which really helped me a lot.

    I’ve added the option “-Djava.net.preferIPv4Stack=true” and it now works fine.

    Thanks everybody!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 298k
  • Answers 298k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can add event handlers manually like this: MyUserControl myControl1… May 13, 2026 at 7:28 pm
  • Editorial Team
    Editorial Team added an answer Be very clear what you are testing. Are you testing… May 13, 2026 at 7:28 pm
  • Editorial Team
    Editorial Team added an answer The problem with your query was that you were returning… May 13, 2026 at 7:28 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.