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

  • SEARCH
  • Home
  • 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 8158161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:31:17+00:00 2026-06-06T17:31:17+00:00

I have a weird issue when connecting to Oracle with Groovy. I have created

  • 0

I have a weird issue when connecting to Oracle with Groovy.
I have created the following test table:

CREATE TABLE t (text VARCHAR2 (256));

INSERT INTO t VALUES ('[Hallo][Hällo][Hello][Hi]');

I want to find all the substrings that are enclosed in square brackets. The following Groovy code fails to find the second ([Hällo]):

import groovy.sql.Sql

sql = Sql.newInstance('jdbc:oracle:thin:@server:1521:ORCL', 'user',
    'password', 'oracle.jdbc.OracleDriver');

sql.eachRow("select text from t") { row ->
    row.text.eachMatch(/\[[A-Za-zä\-]+\]/)  { match ->
        println match
    }
}

Using the string directly works as expected:

'[Hallo][Hällo][Hello][Hi]'.eachMatch(/\[[A-Za-zä\-]+\]/)  { match ->
    println match
}

Also doing the same thing from good ol’ Java works fine. So I’m guessing that the problem should exist somewhere inside the Groovy SQL object.

One final thing I noticed is that the two strings (getting the string from the result set vs embedding it to the source code) do not have the same encoding. When I print Hällo inside eachRow I get H?llo in the Windows console, but when I print it directly I get H├νllo instead.

  • 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-06-06T17:31:19+00:00Added an answer on June 6, 2026 at 5:31 pm

    After further experimentation, the problem seems to be that Groovy reads my script with the default platform encoding. If I pass -c UTF8 to the Groovy interpreter, then I get the expected results.

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

Sidebar

Related Questions

I have a weird issue. I receive the following error that causes a force-close:
I have a weird issue. My unit test passes in the IDE but fails
This is a weird issue. I have created a view controller with a nib
I have this weird issue. I am trying to create a service that synchs
Have a weird issue. I am upgrading from 5.6.2 and following the documented suggested
I have a weird issue. When I create a new Form in Visual Studio
I have a weird issue with creating an Bitmap in C++. I'm using the
I have a weird issue. Here is the setup: I have a NSOperationQueue which
I have a weird issue with printing data out. I use printf to print
I have a weird issue. I have some icons that are being built based

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.